Hi, I am using VS.Net 2002 edition with the 1.1 framework both at University and at home (my home copy is from University using the University licence so I presume is exactly the same)
I have created a front-end application for SQLite (an open source DBMS) which creates databases for users with no SQL knowledge. I link to the DBMS using a .dll file.
When I fill a dataset with the contents of a table at University it works fine then goes onto fill a datagrid with this information. Yet when I run the same application at home I get a "Specified cast is not valid" error.
Not one thing changes to the application, the data in the table, the .dll file, everything is the same in the two instances yet one works and the other doesn't.
Does anyone know what is wrong, if I need to change a setting or install an update on my home PC or something?
Any help is greatly appreciated.
I have included my code and highlighted where the error shows up although I do not believe my code to be the problem as like I said it works on the University PC's.
Many thanks
John
Code for populating dataset and datagrid
I have created a front-end application for SQLite (an open source DBMS) which creates databases for users with no SQL knowledge. I link to the DBMS using a .dll file.
When I fill a dataset with the contents of a table at University it works fine then goes onto fill a datagrid with this information. Yet when I run the same application at home I get a "Specified cast is not valid" error.
Not one thing changes to the application, the data in the table, the .dll file, everything is the same in the two instances yet one works and the other doesn't.
Does anyone know what is wrong, if I need to change a setting or install an update on my home PC or something?
Any help is greatly appreciated.
I have included my code and highlighted where the error shows up although I do not believe my code to be the problem as like I said it works on the University PC's.
Many thanks
John
Code for populating dataset and datagrid
VB.NET:
Private Sub cmbInsertData_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbInsertData.SelectedIndexChanged
Dim dset As DataSet '= New DataSet()
If Len(cmbInsertData.SelectedItem) < 1 Then
MessageBox.Show("Please choose a table to view")
Else
Try
tblName = (cmbInsertData.Text)
setTableName(tblName)
dbConn.openExistingDatabse("Data Source=" & getDBName() & ";Version=3;New=False;Compress=True;")
dbConn.createSQLCommand()
Try
dset = dbConn.selectAll("SELECT * FROM " & tblName, tblName)
Catch es As Exception
MessageBox.Show("error here -" & es.Message)
End Try
StoreDataSet.setDataSet(dset)
DataGrid1.DataSource = dset.Tables(0).DefaultView
Catch es As Exception
MessageBox.Show(es.Message)
End Try
End If
End Sub
VB.NET:
Public Function selectAll(ByVal strSQL As String, ByVal tableName As String)
Dim dset As DataSet = New DataSet()
sqlite_cmd.CommandText = (strSQL)
sqlite_datareader = sqlite_cmd.ExecuteReader()
Dim sqlite_dataAdapter As SQLiteDataAdapter = New SQLiteDataAdapter(strSQL, sqlite_conn)
sqlite_commandBuilder = New SQLiteCommandBuilder(sqlite_dataAdapter)
sqlite_dataAdapter.Fill(dset, tableName)
Return dset
End Function