Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Help with using a Text Box to pass parameters to SQL

Reply
Thread Tools

Help with using a Text Box to pass parameters to SQL

 
 
Jeff Thur
Guest
Posts: n/a
 
      02-03-2005
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.
> .
>
>



...


..


 
Reply With Quote
 
 
 
 
jennifer1970@hotmail.com
Guest
Posts: n/a
 
      02-03-2005
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.
> > .
> >
> >

>
>
> ..
>
>
> .


 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      02-03-2005

>-----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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
div box questions; float text around a box, fit box to image size Gnarlodious HTML 4 05-05-2010 11:30 AM
SQL Reference, SQL Queries, SQL help ecoolone ASP .Net 0 01-03-2008 10:58 AM
how to pass selected item from listbox of one form to text box of other form chintan Software 0 12-19-2007 11:38 AM
How to pass parameter from Datagrid selected row to a text box Ed Dror ASP .Net 4 07-17-2007 03:10 PM
help with using Property to pass parameters Simon ASP .Net 0 11-01-2005 05:56 PM



Advertisments