请教更新语句,请大家指点一下(50分)

  • 主题发起人 主题发起人 camcap
  • 开始时间 开始时间
C

camcap

Unregistered / Unconfirmed
GUEST, unregistred user!
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RecorderID = Page.Request("id")
conn = New SqlConnection("server=192.168.0.207;uid=sa;pwd=;database=supply")
detailsource()
'在此处放置初始化页的用户代码
End Sub
Public Function detailsource()
Dim str As String
str = "select * from salesinfo where id=" &
RecorderID
Dim detaildr As SqlDataReader
Dim detailcomm As SqlCommand
detailcomm = New SqlCommand(str, conn)
conn.Open()
detaildr = detailcomm.ExecuteReader
If detaildr.Read then
customer.Text = "客户名称:" + detaildr.Item("customer")
orderdate.Text = "订单日期:" + Convert.ToString(detaildr.Item("orderdate"))
startdate.Text = Convert.ToString(detaildr.Item("startdate"))
perioddate.Text = Convert.ToString(detaildr.Item("perioddate"))
detail.Text = detaildr.Item("detail")
deal.Text = detaildr.Item("deal")
period.Text = detaildr.Item("period")
textbox3.Text = detaildr.Item("discribe")
End If
conn.Close()
End Function
Sub ExecuteSQL(ByVal sql As String)
Dim mycmd As SqlCommand
mycmd = New SqlCommand(sql, conn)
conn.Open()
mycmd.ExecuteNonQuery()
conn.Close()
End Sub
Private Sub update_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles update.Click
Dim sqlstr As String
sqlstr = "update salesinfo set "
sqlstr = sqlstr &
"detail = '" &
detail.Text &
"',"
sqlstr = sqlstr &
"deal = '" &
deal.Text &
"',"
sqlstr = sqlstr &
"period = '" &
period.Text &
"',"
sqlstr = sqlstr &
"discribe = '" &
textbox3.Text &
"'"
sqlstr = sqlstr &
"where id = " &
RecorderID
ExecuteSQL(sqlstr)
Response.Redirect("userlist.aspx")
End Sub
编译能够通过,但是修改textbox里面的值后数据库并未更新,直接付给一个固定字符串确可以更新,请教这是什么问题?请大家指点一下.谢谢
 
后退
顶部