作者qayqay ( 偶恨vb)
看板Visual_Basic
标题[.NET] vb2005 express + sql server 2005 express 新增资料问题
时间Mon Jun 9 18:21:03 2008
使用vb2005 express 连结 sqlserver2005 express
做一新增资料的按钮
_________________________
Private Sub btnNew_Click
前略
Dim strSQL As String
strSQL = "Insert into tbOder(OrderNO,ODate,OcustomerNo,OProduct,
ONeed,OQ,Priceper,PriceTotal,PreOKdate,PS ) Values (" &
cm & ")"
Dim SQLcomm As New SqlClient.SqlCommand(strSQL, Connection)
Dim Rec As Integer
Try
Rec = SQLcomm.ExecuteNonQuery()
MsgBox("新增" & Rec & "笔资料成功!")
Catch ex As Exception
MsgBox("新增失败!" & ex.ToString)
End Try
Connection.Close()
end sub
______________
还有另一表单
含有datagridview 可直接浏览 资料表tbOder
在新增资料後
会show "新增1笔资料成功!"
去浏览datagridview 的确会出现新的资料
但一按"停止侦错"的正方形
回去看资料库里的资料= =确没有改变
请问这又素 什摸问题=__=a ?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.168.196.87
※ 编辑: qayqay 来自: 218.168.196.87 (06/09 18:22)
1F:→ qayqay:刚刚封装後 就可以罗! (自问自答 =_=|||) 06/09 20:07