Click here to Skip to main content
15,914,500 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionnetworking query Pin
Bhavik N Parekh5-Aug-06 20:03
Bhavik N Parekh5-Aug-06 20:03 
AnswerRe: networking query Pin
Colin Angus Mackay5-Aug-06 21:02
Colin Angus Mackay5-Aug-06 21:02 
AnswerRe: networking query Pin
Craster7-Aug-06 5:25
Craster7-Aug-06 5:25 
Questionpermission Pin
md_refay5-Aug-06 11:20
md_refay5-Aug-06 11:20 
AnswerRe: permission Pin
Mekong River6-Aug-06 2:12
Mekong River6-Aug-06 2:12 
QuestionSelectionChangeCommitted doesn’t run Pin
fiaolle5-Aug-06 10:32
fiaolle5-Aug-06 10:32 
QuestionHow vb send data using MSCOMM?? Pin
areon255-Aug-06 8:00
areon255-Aug-06 8:00 
QuestionSpecified cast is not valid Pin
newbjohny5-Aug-06 4:48
newbjohny5-Aug-06 4:48 
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

Private Sub cmbInsertData_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbInsertData.SelectedIndexChanged<br />
        Dim dset As DataSet '= New DataSet()<br />
        If Len(cmbInsertData.SelectedItem) < 1 Then<br />
            MessageBox.Show("Please choose a table to view")<br />
        Else<br />
            Try<br />
                tblName = (cmbInsertData.Text)<br />
                setTableName(tblName)<br />
                dbConn.openExistingDatabse("Data Source=" & getDBName() & ";Version=3;New=False;Compress=True;")<br />
                dbConn.createSQLCommand()<br />
                Try<br />
                    dset = dbConn.selectAll("SELECT * FROM " & tblName, tblName)<br />
                Catch es As Exception<br />
                    MessageBox.Show("error here -" & es.Message)<br />
                End Try<br />
                StoreDataSet.setDataSet(dset)<br />
                DataGrid1.DataSource = dset.Tables(0).DefaultView<br />
            Catch es As Exception<br />
                MessageBox.Show(es.Message)<br />
            End Try<br />
        End If<br />
    End Sub


Public Function selectAll(ByVal strSQL As String, ByVal tableName As String)<br />
        Dim dset As DataSet = New DataSet()<br />
        sqlite_cmd.CommandText = (strSQL)<br />
        sqlite_datareader = sqlite_cmd.ExecuteReader()<br />
<br />
        Dim sqlite_dataAdapter As SQLiteDataAdapter = New SQLiteDataAdapter(strSQL, sqlite_conn)<br />
        sqlite_commandBuilder = New SQLiteCommandBuilder(sqlite_dataAdapter)<br />
        sqlite_dataAdapter.Fill(dset, tableName)<br />
        Return dset<br />
    End Function

AnswerRe: Specified cast is not valid Pin
Colin Angus Mackay5-Aug-06 5:08
Colin Angus Mackay5-Aug-06 5:08 
GeneralRe: Specified cast is not valid Pin
newbjohny5-Aug-06 5:16
newbjohny5-Aug-06 5:16 
GeneralRe: Specified cast is not valid Pin
Stephen McGuire5-Aug-06 5:20
Stephen McGuire5-Aug-06 5:20 
GeneralRe: Specified cast is not valid Pin
newbjohny5-Aug-06 5:27
newbjohny5-Aug-06 5:27 
GeneralRe: Specified cast is not valid Pin
Stephen McGuire5-Aug-06 5:31
Stephen McGuire5-Aug-06 5:31 
GeneralRe: Specified cast is not valid Pin
Colin Angus Mackay5-Aug-06 5:37
Colin Angus Mackay5-Aug-06 5:37 
GeneralRe: Specified cast is not valid Pin
Stephen McGuire5-Aug-06 5:40
Stephen McGuire5-Aug-06 5:40 
GeneralRe: Specified cast is not valid Pin
newbjohny5-Aug-06 5:42
newbjohny5-Aug-06 5:42 
GeneralRe: Specified cast is not valid Pin
Stephen McGuire5-Aug-06 5:56
Stephen McGuire5-Aug-06 5:56 
GeneralRe: Specified cast is not valid Pin
newbjohny5-Aug-06 6:10
newbjohny5-Aug-06 6:10 
GeneralRe: Specified cast is not valid Pin
Stephen McGuire5-Aug-06 6:16
Stephen McGuire5-Aug-06 6:16 
GeneralRe: Specified cast is not valid Pin
newbjohny5-Aug-06 6:23
newbjohny5-Aug-06 6:23 
GeneralRe: Specified cast is not valid Pin
Stephen McGuire5-Aug-06 6:32
Stephen McGuire5-Aug-06 6:32 
GeneralRe: Specified cast is not valid [modified] Pin
newbjohny5-Aug-06 6:45
newbjohny5-Aug-06 6:45 
GeneralRe: Specified cast is not valid Pin
Stephen McGuire5-Aug-06 6:56
Stephen McGuire5-Aug-06 6:56 
GeneralRe: Specified cast is not valid Pin
newbjohny5-Aug-06 7:02
newbjohny5-Aug-06 7:02 
GeneralRe: Specified cast is not valid Pin
Stephen McGuire5-Aug-06 7:06
Stephen McGuire5-Aug-06 7:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.