lundi 29 décembre 2014

accesing sqlite database using vb .net

I am new to VB .net and working with SQLite. I am not able to access Test1.db3, the code below simply creates a new file Test1.db3, therefore when I go to read the file I receive a response saying table 'Users' doesn't exist. I am using VS Express 2013.



Sub Main()

Dim Path As String = "J:\Location\SQLITE\"
Dim dataBase As String = "test1.db"
Dim cs As String = Path & dataBase
Dim myConnection As New SQLiteConnection()
Dim cadeomSQL As String = "Data Source=" & cs & ";"

myConnection.ConnectionString = cadeomSQL
myConnection.Open()

Dim sSQL As String = "SELECT * FROM Users"
Using cmd As New SQLiteCommand(sSQL, myConnection)

Dim rdr As SQLiteDataReader = cmd.ExecuteReader()

Using rdr
While (rdr.Read())
Console.WriteLine(rdr.GetString(0) & rdr.GetString(1) & rdr.GetString(2))
End While
End Using
End Using
myConnection.Close()
End Sub


Any advice will be much appreciated


Aucun commentaire:

Enregistrer un commentaire