Hi, I am trying to open a database, using the input database name given by
the user, if I run the testDB() function where the source of the database is
given, it works fine, but if I try to use the createNewdatabase() function,
passing back the string with the filename from the input and it doesn't
work, I was wondering if anyone could help me as to where I'm going wrong, I
have attached the code I am using below.
Many thanks.
John
This works fine
Public Function testDB()
' create a new database
sqlite_conn = New SQLiteConnection("Data
Source=D:\test.db;Version=3;New=True;Compress=True;")
End Function
This doesn't
Public Function createNewdatabase(ByVal strSQL As String)
' create a new database
sqlite_conn = New SQLiteConnection(strSQL)
End Function
Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNew.Click
Dim dbConn As dbConnection = New dbConnection()
Dim FlName As String
With SaveFileDialog1
'.DefaultExt = ".db"
.Filter = "SQLite Database Files|*.db|All Files|*.*"
If .ShowDialog() = DialogResult.OK Then
.FileName = FileName
FlName = FileName
' create a new database with given name
dbConn.createNewdatabase("Data Source=" & FlName &
";Version=3;New=True;Compress=True;")
End If
End With
End Sub