Help with using a Text Box to pass parameters to SQL

Discussion in 'ASP .Net Web Controls' started by Jeff Thur, Feb 3, 2005.

  1. Jeff Thur

    Jeff Thur Guest

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



    ...


    ..
     
    Jeff Thur, Feb 3, 2005
    #1
    1. Advertising

  2. Jeff Thur

    Guest

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

    >
    >
    > ..
    >
    >
    > .
     
    , Feb 3, 2005
    #2
    1. Advertising

  3. Jeff Thur

    Guest Guest


    >-----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(connectionString)
    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
     
    Guest, Feb 3, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon
    Replies:
    0
    Views:
    347
    Simon
    Nov 1, 2005
  2. Gnarlodious
    Replies:
    4
    Views:
    17,640
    elizas
    May 5, 2010
  3. Ed Dror
    Replies:
    4
    Views:
    5,379
    Ed Dror
    Jul 17, 2007
  4. ecoolone
    Replies:
    0
    Views:
    783
    ecoolone
    Jan 3, 2008
  5. AAaron123
    Replies:
    2
    Views:
    300
    AAaron123
    Jan 21, 2009
Loading...

Share This Page