When a Dropdownlist selectedindex changed event is fired, I have to take that selection and pass it to the SQLServer Stored proc. But i keep getting an error that "Could not find Stored proc" This is my code. Please guide me where I am going wrong.
thanks
dim arttypeid as integer=me.ddl1.selectedindex Dim
cslist AsString Dim
comm AsNewSqlCommand comm.Connection = sqlConn
comm.CommandType =CommandType.StoredProcedure comm.CommandText ="ListValues
"& arttypeid
sqlConn.Open()
comm.ExecuteNonQuery()
adapter1 =NewSqlDataAdapter(comm) adapter1.Fill(ds1) For
i AsInteger
= 0 To
ds1.Tables(0).Rows.Count - 1 cslist = ds1.Tables(0).Rows(i).Item(0)
Response.Write(cslist) Next adapter1.Dispose() Catch
ex AsException Response.Write(ex) EndTry sqlConn.Close()
sqlConn.Dispose()
snailpace
Member
31 Points
285 Posts
Stored proc not returning values
Apr 30, 2012 06:04 PM|LINK
Hi, Using VS 2010, vb.net with SQL 2008.
When a Dropdownlist selectedindex changed event is fired, I have to take that selection and pass it to the SQLServer Stored proc. But i keep getting an error that "Could not find Stored proc" This is my code. Please guide me where I am going wrong.
thanks
dim arttypeid as integer=me.ddl1.selectedindex
Dim cslist As String
Dim comm As New SqlCommand
comm.Connection = sqlConn
comm.CommandType =CommandType.StoredProcedure
comm.CommandText ="ListValues "& arttypeid
sqlConn.Open()
comm.ExecuteNonQuery()
adapter1 =New SqlDataAdapter(comm)
adapter1.Fill(ds1)
For i As Integer = 0 To ds1.Tables(0).Rows.Count - 1
cslist = ds1.Tables(0).Rows(i).Item(0)
Response.Write(cslist)
Next
adapter1.Dispose()
Catch ex As Exception
Response.Write(ex)
End Try
sqlConn.Close()
sqlConn.Dispose()