D
Daren Kovacs via DotNetMonster.com
Hi,
I have created and tested a stored procedure with some input values and one
output value. When I run it the page seems to come up but no data exists,
and no errors. This is odd because there if definitely info ont he
table/datbase. My code is below if anyone can see what I might be doing
wrong.
Dim MyConnection As New SqlConnection(ConfigurationSettings.AppSettings
("ConnectionString"))
Dim cmd As New SqlCommand("uspSearch", MyConnection)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@suburbtown", SqlDbType.Varchar, 30)
cmd.Parameters("@suburbtown").Direction = ParameterDirection.Input
cmd.Parameters("@suburbtown").Value = ""
cmd.Parameters.Add("@accountant_type", SqlDbType.Int)
cmd.Parameters("@accountant_type").Direction =
ParameterDirection.Input
cmd.Parameters("@accountant_type").Value = 15
cmd.Parameters.Add("@keyword", SqlDbType.Varchar, 25)
cmd.Parameters("@keyword").Direction = ParameterDirection.Input
cmd.Parameters("@keyword").Value = ""
cmd.Parameters.Add("@state", SqlDbType.Varchar, 3)
cmd.Parameters("@state").Direction = ParameterDirection.Input
cmd.Parameters("@state").Value = "TAS"
cmd.Parameters.Add("@PageSize", SqlDbType.Int)
cmd.Parameters("@PageSize").Direction = ParameterDirection.Input
cmd.Parameters("@PageSize").Value = 10
cmd.Parameters.Add("@CurrentPage", SqlDbType.Int)
cmd.Parameters("@CurrentPage").Direction = ParameterDirection.Input
cmd.Parameters("@CurrentPage").Value = 1
cmd.Parameters.Add("@FullCount", SqlDbType.Int)
cmd.Parameters("@FullCount").Direction = ParameterDirection.Output
Dim adapter As New SqlDataAdapter(cmd)
Dim ds As New DataSet()
adapter.Fill(ds)
ListResults.DataSource = ds
ListResults.DataBind()
I have created and tested a stored procedure with some input values and one
output value. When I run it the page seems to come up but no data exists,
and no errors. This is odd because there if definitely info ont he
table/datbase. My code is below if anyone can see what I might be doing
wrong.
Dim MyConnection As New SqlConnection(ConfigurationSettings.AppSettings
("ConnectionString"))
Dim cmd As New SqlCommand("uspSearch", MyConnection)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@suburbtown", SqlDbType.Varchar, 30)
cmd.Parameters("@suburbtown").Direction = ParameterDirection.Input
cmd.Parameters("@suburbtown").Value = ""
cmd.Parameters.Add("@accountant_type", SqlDbType.Int)
cmd.Parameters("@accountant_type").Direction =
ParameterDirection.Input
cmd.Parameters("@accountant_type").Value = 15
cmd.Parameters.Add("@keyword", SqlDbType.Varchar, 25)
cmd.Parameters("@keyword").Direction = ParameterDirection.Input
cmd.Parameters("@keyword").Value = ""
cmd.Parameters.Add("@state", SqlDbType.Varchar, 3)
cmd.Parameters("@state").Direction = ParameterDirection.Input
cmd.Parameters("@state").Value = "TAS"
cmd.Parameters.Add("@PageSize", SqlDbType.Int)
cmd.Parameters("@PageSize").Direction = ParameterDirection.Input
cmd.Parameters("@PageSize").Value = 10
cmd.Parameters.Add("@CurrentPage", SqlDbType.Int)
cmd.Parameters("@CurrentPage").Direction = ParameterDirection.Input
cmd.Parameters("@CurrentPage").Value = 1
cmd.Parameters.Add("@FullCount", SqlDbType.Int)
cmd.Parameters("@FullCount").Direction = ParameterDirection.Output
Dim adapter As New SqlDataAdapter(cmd)
Dim ds As New DataSet()
adapter.Fill(ds)
ListResults.DataSource = ds
ListResults.DataBind()