MySQL有暫存變數的語法,例如:SELECT @var := 1
如果要在VB.NET使用這種語法,只要在MySQL連線設定的字串裡加入allowuservariables=true
即可。
Dim server As String = "localhost"
Dim port As Integer = 3306
Dim dbName As String = "MyDB"
Dim user As String = "root"
Dim pw As String = "MyPassword"
Dim connectionStr As String = String.Format(
"server={0}; port={1}; database={2}; user id={3}; password={4}; allowuservariables=true;",
server, port, dbName, user, pw)
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up