S
Stu Lock
Hi,
I have converted some code to try and databind a datagrid using a stored
procedure. Basically I am now naming the SP, setting the command type and
adding and loading a prameter instead of just passing an SQL string.
When I run the code below I get the error "Input string was not in a correct
format." on the 'da.Fill(ds, "Prices")' line....and I have no idea why!
Can anyone point me in the right direction.
Thanks in advance,
Stu
--/ snip /--
Dim cn = New SqlConnection("MyConnString")
cn.Open()
Dim cmd As New SqlCommand("SP_ListAllPrices", cn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@Countries_ID", SqlDbType.Int)
cmd.Parameters("@Countries_ID").Value = ddlCountries_ID.SelectedValue
Dim da = New SqlDataAdapter(cmd)
Dim ds = New DataSet
da.Fill(ds, "Prices") <<<<<<<<<<<<<<< error
DataGrid1.DataSource = ds
DataGrid1.DataBind()
da = Nothing
cn.Close()
--/ snip /--
I have converted some code to try and databind a datagrid using a stored
procedure. Basically I am now naming the SP, setting the command type and
adding and loading a prameter instead of just passing an SQL string.
When I run the code below I get the error "Input string was not in a correct
format." on the 'da.Fill(ds, "Prices")' line....and I have no idea why!
Can anyone point me in the right direction.
Thanks in advance,
Stu
--/ snip /--
Dim cn = New SqlConnection("MyConnString")
cn.Open()
Dim cmd As New SqlCommand("SP_ListAllPrices", cn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@Countries_ID", SqlDbType.Int)
cmd.Parameters("@Countries_ID").Value = ddlCountries_ID.SelectedValue
Dim da = New SqlDataAdapter(cmd)
Dim ds = New DataSet
da.Fill(ds, "Prices") <<<<<<<<<<<<<<< error
DataGrid1.DataSource = ds
DataGrid1.DataBind()
da = Nothing
cn.Close()
--/ snip /--