>-----Original Message-----
>Hi Jeff,
>
>Use cbname.selecteditem. But you
have .state.selectedvalue - is 'state' the
>name of your combobox? If it is, change it, because
it's conficting with
>the name of the parameter.
>
>HTH,
>
>Bernie Yaeger
>
Hi Bernie,
Thats it. Also Would you know
How can I select multiple States from the drop down box
and pass them on to my SQL Query.
Thank You VERY MUCH.
Jeff...........
>
>"Jeff Thur" <(E-Mail Removed)> wrote in message
>news:4d8101c524de$aa4a68b0$(E-Mail Removed)...
>>I am running a SQL Stored Procedure that will give the
>> user a count of how many records are in the database as
>> per certain criteria.
>> I'm using the Execute Scalar Method.
>> I have no problem passing values that the user inputs
>> into Text boxes to my Stored Procedure. However I have
a
>> drop down list with a listing of the individual States,
>> which the user selects. I am trying to use the
>> SelectedValue of the drop down list but I am getting a
>> message that SelectedValue is not a member of the
>> parameter collection. Would anybody know how to pass
that
>> parameter to the Stored procedure. Below is a piece of
>> the program to look at. Thanks for any help that can be
>> provided.
>>
>>
>> Sub GetCount
>>
>> Dim MyConnection As SqlConnection
>> MyConnection = New SqlConnection("server='(local)';
user
>> id='sa'; password='fritz'; database='Cutis'")
>> Dim testCMD As SqlCommand = New SqlCommand
("EMSCOUNTER",
>> MyConnection)
>> testCMD.CommandType = CommandType.StoredProcedure
>>
>> Dim Last As SqlParameter = testCMD.Parameters.Add
>> ("@Last", SqlDbType.VarChar, 6)
>> Last.Value = TxtLast.Text
>>
>> Dim First As SqlParameter = testCMD.Parameters.Add
>> ("@First", SqlDbType.VarChar, 1)
>> First.Value = TxtFirst.Text
>>
>> Dim Subscr As SqlParameter = testCMD.Parameters.Add
>> ("@Subscr", SqlDbType.VarChar, 10)
>> Subscr.Value = TxtSubscr.Text
>>
>> Dim State As SqlParameter = testCMD.Parameters.Add
>> ("@State", SqlDbType.VarChar, 2)
>> State.Value = State.SelectedValue
>>
>>
>> MyConnection.Open()
>>
>> TxtCount.Text = testcmd.ExecuteScalar()
>> MyConnection.Close()
>>
>>
>> End Sub
>>
>
>
>.
>
|