P
Patrick Olurotimi Ige
Hi DevGuy thx for the reply but using:-
Cmd.Parameters.Add(New SqlParameter("@DebtorCodeID",
Still give the same error!!!
Whereas Charmis advice is good but in my case i'm using
NextResults() like so below:-
How should i use the
If DropDown.SelectedIndex > 0 Then
EndIf
Without affecting the "objDR.NextResult()"
Code Below:--
------------------
Try
MyConn.Open()
objDR = Cmd.ExecuteReader
ddlFill1.DataSource = objDR
ddlFill1.DataValueField = "AddressID"
ddlFill1.DataTextField = "Suburb"
ddlFill1.DataBind()
objDR.NextResult()
ddlFill2.DataSource = objDR
ddlFill2.DataValueField = "AddressID"
ddlFill2.DataTextField = "Suburb"
ddlFill2.DataBind()
'ddlFill2.Items.Insert(0, "-Select Delivey Address-")
objDR.NextResult()
With ddlFill3
.DataSource = objDR
.DataValueField = "AddressID"
.DataTextField = "Suburb"
.DataBind()
'ddlFill3.Items.Insert(0, "-Select Billing Address-")
End With
objDR.NextResult()
With ddlFill4
.DataSource = objDR
.DataValueField = "TelstraAccID"
.DataTextField = "TelstraAccNo"
.DataBind()
End With
ddlFill1.Items.Insert(0, "-Select Site Address-")
ddlFill2.Items.Insert(0, "-Select Delivey Address-")
ddlFill3.Items.Insert(0, "-Select Billing Address-")
Catch ex As SqlException
Response.Write(ex.ToString)
Finally
If Not (objDR Is Nothing) Then
objDR.Close()
End If
MyConn.Dispose()
End Try
the error is :-
DebtorCodeID is an integer
But when somebody selects a Value and does a Postback and gets back to
"Select Debtor Code" and select it it RETURNS an error!:-
System.Data.SqlClient.SqlException: Error converting data type nvarchar
to int. at
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at
System.Data.SqlClient.SqlCommand.ExecuteReader() at
Online_Ordering.CheckOut.FillAll(Object sender, EventArgs e) in
c:\inetpub\wwwroot\Online_Ordering\CheckOut.aspx.vb:line 209
Cmd.Parameters.Add(New SqlParameter("@DebtorCodeID",
ddlGetDebtor.SelectedItem.Value.ToString))
Still give the same error!!!
Whereas Charmis advice is good but in my case i'm using
NextResults() like so below:-
How should i use the
If DropDown.SelectedIndex > 0 Then
EndIf
Without affecting the "objDR.NextResult()"
Code Below:--
------------------
Try
MyConn.Open()
objDR = Cmd.ExecuteReader
ddlFill1.DataSource = objDR
ddlFill1.DataValueField = "AddressID"
ddlFill1.DataTextField = "Suburb"
ddlFill1.DataBind()
objDR.NextResult()
ddlFill2.DataSource = objDR
ddlFill2.DataValueField = "AddressID"
ddlFill2.DataTextField = "Suburb"
ddlFill2.DataBind()
'ddlFill2.Items.Insert(0, "-Select Delivey Address-")
objDR.NextResult()
With ddlFill3
.DataSource = objDR
.DataValueField = "AddressID"
.DataTextField = "Suburb"
.DataBind()
'ddlFill3.Items.Insert(0, "-Select Billing Address-")
End With
objDR.NextResult()
With ddlFill4
.DataSource = objDR
.DataValueField = "TelstraAccID"
.DataTextField = "TelstraAccNo"
.DataBind()
End With
ddlFill1.Items.Insert(0, "-Select Site Address-")
ddlFill2.Items.Insert(0, "-Select Delivey Address-")
ddlFill3.Items.Insert(0, "-Select Billing Address-")
Catch ex As SqlException
Response.Write(ex.ToString)
Finally
If Not (objDR Is Nothing) Then
objDR.Close()
End If
MyConn.Dispose()
End Try
the error is :-
DebtorCodeID is an integer
But when somebody selects a Value and does a Postback and gets back to
"Select Debtor Code" and select it it RETURNS an error!:-
System.Data.SqlClient.SqlException: Error converting data type nvarchar
to int. at
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at
System.Data.SqlClient.SqlCommand.ExecuteReader() at
Online_Ordering.CheckOut.FillAll(Object sender, EventArgs e) in
c:\inetpub\wwwroot\Online_Ordering\CheckOut.aspx.vb:line 209