L
Loogie
Hello
Using VB.Net 2005 compact framework and SQL CE Server
I have code that is supposed to retrieve data from an SQL CE Server
database and populate a textbox and a select a value in a combobox.
I have verified that the code driving data to the tables works using
Query Analyzer so the problem must be in syntax in my SQL.
The error I am getting is 'The column name is not valid. [ Node name (if
any) = ,Column name = X ]' and it is thrown in the line Dim myReaderU As
SqlCeDataReader = cmdU.ExecuteReader()
Here is the code...any help appreciated.
Thanks
:L
Dim ssceconnU As New SqlCeConnection("Data Source = \Program
Files\data\products\" & clsGlobals.Form4.txtName.Text & ".sdf")
ssceconnU.Open()
Dim X As Integer
X = CInt(clsGlobals.Form4.lsvProds.FocusedItem.Text) '
verified that this is giving me the correct value
Dim cmdU As New
System.Data.SqlServerCe.SqlCeCommand("SELECT * FROM product WHERE p_item
= X", ssceconnU)
Dim myReaderU As SqlCeDataReader = cmdU.ExecuteReader() '
error thrown here
cboCode.SelectedItem = myReaderU.Item("p_code")
txtName.Text = myReaderU.Item("p_name")
Dim cmdU2 As New
System.Data.SqlServerCe.SqlCeCommand("SELECT * FROM prodspecies WHERE
s_link = '" & cboCode.SelectedItem.ToString & "'", ssceconnU)
Dim myReaderU2 As SqlCeDataReader = cmdU2.ExecuteReader()
Do While myReaderU2.Read()
lstIn.Items.Add(myReaderU2.Item("s_code"))
Loop
myReaderU.Close()
myReaderU.Dispose()
myReaderU = Nothing
myReaderU2.Close()
myReaderU2.Dispose()
myReaderU2 = Nothing
ssceconnU.Close()
ssceconnU.Dispose()
ssceconnU = Nothing
Using VB.Net 2005 compact framework and SQL CE Server
I have code that is supposed to retrieve data from an SQL CE Server
database and populate a textbox and a select a value in a combobox.
I have verified that the code driving data to the tables works using
Query Analyzer so the problem must be in syntax in my SQL.
The error I am getting is 'The column name is not valid. [ Node name (if
any) = ,Column name = X ]' and it is thrown in the line Dim myReaderU As
SqlCeDataReader = cmdU.ExecuteReader()
Here is the code...any help appreciated.
Thanks
:L
Dim ssceconnU As New SqlCeConnection("Data Source = \Program
Files\data\products\" & clsGlobals.Form4.txtName.Text & ".sdf")
ssceconnU.Open()
Dim X As Integer
X = CInt(clsGlobals.Form4.lsvProds.FocusedItem.Text) '
verified that this is giving me the correct value
Dim cmdU As New
System.Data.SqlServerCe.SqlCeCommand("SELECT * FROM product WHERE p_item
= X", ssceconnU)
Dim myReaderU As SqlCeDataReader = cmdU.ExecuteReader() '
error thrown here
cboCode.SelectedItem = myReaderU.Item("p_code")
txtName.Text = myReaderU.Item("p_name")
Dim cmdU2 As New
System.Data.SqlServerCe.SqlCeCommand("SELECT * FROM prodspecies WHERE
s_link = '" & cboCode.SelectedItem.ToString & "'", ssceconnU)
Dim myReaderU2 As SqlCeDataReader = cmdU2.ExecuteReader()
Do While myReaderU2.Read()
lstIn.Items.Add(myReaderU2.Item("s_code"))
Loop
myReaderU.Close()
myReaderU.Dispose()
myReaderU = Nothing
myReaderU2.Close()
myReaderU2.Dispose()
myReaderU2 = Nothing
ssceconnU.Close()
ssceconnU.Dispose()
ssceconnU = Nothing