You are passing the names of the variables, try this...
Note the lack of quotes around ibus and iloc
mySqlDa.SelectCommand.Parameters.Add(New SqlParameter
("@businessID", ibus))
mySqlDa.SelectCommand.Parameters.Add(New SqlParameter
("@locationID", iloc))
On Apr 11, 2005 11:50 PM, kstrader2002 <[EMAIL PROTECTED]> wrote:
>
>
> I have 2 input parameters for a stored procedure which are being
> passed thru a query string from page to page. The two values are
> business and location. Each of these values is a number so the
> query string looks like ?business=39&location=40
>
> when I reference these values when creating my sqldataAdapter and
> dataset I receive an error that the system cannot convert nvarchar
> to type int.
>
> Here is my code:
> Dim mySqlDa As New SqlDataAdapter
> mySqlDa.SelectCommand = New SqlCommand("spgetLocationUsers",
> MyConnection)
>
> Dim location As String = Request.QueryString("location")
> Dim business As String = Request.QueryString("business")
> Dim iloc As Integer = Convert.ToInt32(location)
> Dim iBus As Integer = Convert.ToInt32(business)
>
> mySqlDa.SelectCommand.CommandType =
> CommandType.StoredProcedure
> mySqlDa.SelectCommand.Parameters.Add(New SqlParameter
> ("@businessID", "ibus"))
> mySqlDa.SelectCommand.Parameters.Add(New SqlParameter
> ("@locationID", "iloc"))
> Dim myds As New DataSet
> mySqlDa.Fill(myds, "users")
>
> If I replace ibus and iloc with the actual values that they
> represent ("39" and "40") - everything works fine - but when I try
> to do it using what is being passed from the query string it errors
> on the data type. The database has each of these values defined as
> Int - and I assume that they are treated as string values in the
> query string so I thought converting them to integer values would
> address the issue as I did above - but still no luck. any
> suggestions?
>
>
> Yahoo! Groups Links
>
>
>
>
>
--
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/