In VS 2008, for example I have sql command like
SELECT * FROM STUDENTS WHERE STUDENTID = @STUDENTID
Then I append value into it, for example 15
How to I catch this sql command
SELECT * FROM STUDENTS WHERE STUDENTID = 15
Thx in advance

In VS 2008, for example I have sql command like
SELECT * FROM STUDENTS WHERE STUDENTID = @STUDENTID
Then I append value into it, for example 15
How to I catch this sql command
SELECT * FROM STUDENTS WHERE STUDENTID = 15
Thx in advance

Hello maybe this will help

I used this on VB 2005 to information for a crystal report

Dim strConnection As String = "Server=...\SQLEXPRESS; Database=db;uid=admin;Password=password"
        Dim Connection As New SqlConnection(strConnection)

        Dim norden As String
        norden = TextBox1.Text.ToString
        Dim strSQL As String = " (SELECT * FROM or_compra WHERE(or_compra.orden = " & norden & "))SELECT     oc_desc.orden , oc_desc.cantidad, oc_desc.descripcion, oc_desc.importe FROM oc_desc INNER JOIN or_compra ON oc_desc.orden = or_compra.orden WHERE(oc_desc.orden =" & norden & ") "
        Dim DA As New SqlDataAdapter(strSQL, Connection)
        Dim DS As New DataSet
        Dim strReportName As String

As you can see the string "norden" i used it as a variable to search for an especific number and integrated it to the SQL Query you can see this in this section of the sql query

(SELECT * FROM or_compra WHERE(or_compra.orden = " & norden & "))

You can add a TextBox to the SQL Query if you need it not just a number.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.