Problems selecting from a db
Posted: Mon 21 Mar 2005 16:31
Hi,
I am trying to select a value from a dtatabase using mysqlcommand, but I always get an error that ' No data exists for the row/column.'
Here's my code:
Me.com_cdl = New CoreLab.MySql.MySqlCommand
Me.com_cdl.CommandTimeout = 30
Me.com_cdl.Connection = Me.con_cdl
Me.com_cdl.Name = "com_cdl"
con_cdl.Open()
Try
com_cdl.CommandText = "SELECT * from tblpersonal"
com_cdl.FetchAll = True
com_cdl.ExecuteReader()
While com_cdl.ExecuteReader.Read()
Console.WriteLine(com_cdl.ExecuteReader.GetInt32(0).ToString())
End While
Now, I have tried many ' com_cdl.ExecuteReader, like getvalue, get string, item, hasrows - only 'hasrows' returns true, everything else gives me the error I mentioned above.
I am new to this so perhaps I am missing something obvious!
Will be grateful for any ideas!
- Tom
I am trying to select a value from a dtatabase using mysqlcommand, but I always get an error that ' No data exists for the row/column.'
Here's my code:
Me.com_cdl = New CoreLab.MySql.MySqlCommand
Me.com_cdl.CommandTimeout = 30
Me.com_cdl.Connection = Me.con_cdl
Me.com_cdl.Name = "com_cdl"
con_cdl.Open()
Try
com_cdl.CommandText = "SELECT * from tblpersonal"
com_cdl.FetchAll = True
com_cdl.ExecuteReader()
While com_cdl.ExecuteReader.Read()
Console.WriteLine(com_cdl.ExecuteReader.GetInt32(0).ToString())
End While
Now, I have tried many ' com_cdl.ExecuteReader, like getvalue, get string, item, hasrows - only 'hasrows' returns true, everything else gives me the error I mentioned above.
I am new to this so perhaps I am missing something obvious!
Will be grateful for any ideas!
- Tom