Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   Help with using a Text Box to pass parameters to SQL (http://www.velocityreviews.com/forums/t775325-help-with-using-a-text-box-to-pass-parameters-to-sql.html)

Jeff Thur 02-03-2005 07:42 PM

Help with using a Text Box to pass parameters to SQL
 
I need help with the following:
> I am doing a lookup screen for users.
> I am accessing a SQL Query.
> The User can enter either a State or the first 6
> characters of the first name and the first name initial.
> Passing a parameter of the State code is not a problem,
> as I can do it with a Drop Down box and use
> SelectedValue. However I need the user to be able to
> enter the first 6 characters of the last name and the
> first intial of the first name into a Text type Box. I
> tried to use a Text Box Control for this but as I found
> out, the Text Box doesn't Support the SelectedValue so
> this won't cut it for me. I am not sure how to use the

textbox for passing parameters.


Any ideas as to how I would go
> about this would be welcomed. Thank You for any help

that
> you can provide.
> .
>
>



...


..



jennifer1970@hotmail.com 02-03-2005 10:34 PM

Re: Help with using a Text Box to pass parameters to SQL
 
Ummm.... Textbox1.Text?


Jeff Thur wrote:
> I need help with the following:
> > I am doing a lookup screen for users.
> > I am accessing a SQL Query.
> > The User can enter either a State or the first 6
> > characters of the first name and the first name initial.
> > Passing a parameter of the State code is not a problem,
> > as I can do it with a Drop Down box and use
> > SelectedValue. However I need the user to be able to
> > enter the first 6 characters of the last name and the
> > first intial of the first name into a Text type Box. I
> > tried to use a Text Box Control for this but as I found
> > out, the Text Box doesn't Support the SelectedValue so
> > this won't cut it for me. I am not sure how to use the

> textbox for passing parameters.
>
>
> Any ideas as to how I would go
> > about this would be welcomed. Thank You for any help

> that
> > you can provide.
> > .
> >
> >

>
>
> ..
>
>
> .



02-03-2005 11:30 PM

Help with using a Text Box to pass parameters to SQL
 

>-----Original Message-----
>I need help with the following:
>> I am doing a lookup screen for users.
>> I am accessing a SQL Query.
>> The User can enter either a State or the first 6
>> characters of the first name and the first name

initial.
>> Passing a parameter of the State code is not a problem,
>> as I can do it with a Drop Down box and use
>> SelectedValue. However I need the user to be able to
>> enter the first 6 characters of the last name and the
>> first intial of the first name into a Text type Box. I
>> tried to use a Text Box Control for this but as I found
>> out, the Text Box doesn't Support the SelectedValue so
>> this won't cut it for me. I am not sure how to use

the
>textbox for passing parameters.
>
>
>Any ideas as to how I would go
>> about this would be welcomed. Thank You for any help

>that
>> you can provide.
>> .
>>
>>

>
>
>...
>
>
>..
>
>I Know a TextBox.Text will do it, However I need the

Flow, This is my Test Program but it doesn't work.

Sub Button1_Click(sender As Object, e As EventArgs)
DataGrid1.DataSource = dbCommand.ExecuteReader()
DataGrid1.DataBind()
End Sub



Sub Page_Load(sender As Object, e As EventArgs)

Dim sParam As String = TxtLast.Text
Dim sSQL As String = "Select Col099, Col008, Col017,
Col018 From Jeff Where Col099 = @Col099"
Dim connectionString As String = "server='(local)'; user
id='sa'; password='fritz'; database='Cutis'"
Dim dbConnection As System.Data.IDbConnection = New
System.Data.SqlClient.SqlConnection(connectionStri ng)
Dim dbCommand As System.Data.IDbCommand = New
System.Data.SqlClient.SqlCommand
Try
dbcommand.Parameters.Add ("@Col099")
dbCommand.CommandType = (sSQL)
dbConnection.Open()
dbConnection.Close()
Catch dbError As Exception
dbConnection.Close()
End Try



End Sub



All times are GMT. The time now is 10:18 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.