2012-02-26 62 views

回答

0
dim conn As New MySqlConnection <br> 
dim comm As New MySqlCommand<br><br> 
dim dAdapter As New MySqlDataAdapter<br> 
dim ddata As New DataSet<br> 

conn.ConnectionString = "DATABASE=" & ddatabase & ";SERVER=" & Trim(TextBox1.Text) & ";user id=dev;password=revolution;port=" & TextBox3.Text & " ;charset=utf8;<b>Allow User Variables=True" </b><br> 
conn.Open() <br> 
<br> 
comm.Connection = conn<br> 
comm.CommandText = "set @rownum = 10"<br> 
comm.ExecuteNonQuery() <br> 
<br> 
ddata.Clear()<br> 
ddata.Tables.Clear()<br> 
comm.Connection = conn<br> 
comm.CommandText = "select @rownum rownum"<br> 
dAdapter.SelectCommand = comm <br> 
dAdapter.Fill(ddata)<br> 
<br> 
msgbox(ddata.Tables(0).Rows(0).Item("rownum")) <br> 
1

必須把這個鍵添加到您的連接字符串:「允許用戶變量= TRUE;」

+0

謝謝!一直試圖找出這個好幾個小時! – 2017-05-31 08:59:06

相關問題