Results 1 to 9 of 9

Thread: [2008] Using variables in an SQL string

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2009
    Posts
    80

    [2008] Using variables in an SQL string

    It is possible to use a variable in the SQL string below?
    Because the string is in quotes, I didn't know if it would recognize it as a variable.

    Just for some background, 'bfguide' is the name of the database, 'rate' is the name of the table, and 'count' is the name of a field in the table.

    VB Code:
    1. myConnection = New MySqlConnection("server=localhost; user id=admin; password=******; database=bfguide; pooling=false;")
    2.  
    3.  --->   strSQL = "UPDATE rate SET count =  **variable** WHERE ID = 1;"
    4.  
    5.         myDataAdapter = New MySqlDataAdapter(strSQL, myConnection)
    6.         myDataSet = New DataSet()
    7.         myDataAdapter.Fill(myDataSet, "bfguide")
    8.  
    9.         MySQLDataGrid.DataSource = myDataSet
    10.         MySQLDataGrid.DataBind()
    Last edited by nickf77; Mar 3rd, 2009 at 09:11 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width