我有这些密码
Call Connection
Dim SQLInsert As String
SQLInsert = "INSERT INTO `Admin` (" & _
"`kode`," & _
"`nama`," & _
"`password`," & _
"`level`" & _
") VALUES (" & _
"'" & Text1.Text & "', " & _
"'" & Text2.Text & "', " & _
"'" & Text3.Text & "', " & _
"'" & Combo1.Text & "'" & _
")"
conn.Execute SQLInsert
MsgBox "Insert Succeed"如何从上面的语句中获得返回的值,无论代码成功还是失败.
我想得到与PHP类似的返回值
<?php
$result = mysqli_query($link, $sql);
if ($result)
//executing other code在VB6里我该怎么做呢?谢谢
发布于 2015-09-18 07:03:12
应该有可能使‘行受影响’值返回。请阅读此Microsoft:
https://msdn.microsoft.com/en-us/library/ms681559(v=vs.85).aspx
您需要添加“adExecuteNoRecords”选项,章节“备注”
发布于 2015-09-18 04:49:05
阅读关于论误差语句的文章。它允许在VB中处理异常。
Dim SQLInsert As String
ON ERROR GOTO ErrorHandler
SQLInsert = "INSERT INTO `Admin` (" & _
"`kode`," & _
"`nama`," & _
"`password`," & _
"`level`" & _
") VALUES (" & _
"'" & Text1.Text & "', " & _
"'" & Text2.Text & "', " & _
"'" & Text3.Text & "', " & _
"'" & Combo1.Text & "'" & _
")"
conn.Execute SQLInsert
MsgBox "Insert Succeed"
Exit Sub
ErrorHandler:
Msg = "Error # " & Str(Err.Number) & " was generated by " &
Err.Source & ControlChars.CrLf & Err.Description
MsgBox(Msg, MsgBoxStyle.Information, "Error")
Exit Subhttps://stackoverflow.com/questions/32643845
复制相似问题