|
 |
|
ASP.Net ช่วยดูโค้ดให้หน่อยค่ะ หน้าแก้ไข มันไม่เข้าฐานข้อมูลอ่ะค่ะ |
|
 |
|
|
 |
 |
|
เป็นการแก้ไขจาก GridView ส่งค่ามาหาอีก page นึง แล้วทำการแก้ไข ตอนนี้ส่งค่ามาอีก page ได้แล้ว แต่ มันไม่แก้ไขข้อมูลลงฐานข้อมูลให้อ่ะค่ะ ช่วยหน่อยน่ะค่ะ เพิ่งหัดทำเป็นครั้งแรกค่ะ
Code (ASP)
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
Try
tmpPictureName = FileUpload1.FileName
tmpPathFilePicture = "~/Mypic/" & tmpPictureName
Dim CurrentPath As String = Server.MapPath("~/Mypic/")
If FileUpload1.HasFile Then
CurrentPath += tmpPictureName
FileUpload1.SaveAs(CurrentPath)
tmpPathFilePicture = "~/Mypic/" & tmpPictureName
Else
tmpPathFilePicture = Image1.ImageUrl
End If
strSQL = "UPDATE tblTool SET " & _
" ToolID = '" & Me.lblToolID.Text & "' " & _
" ,ToolName = '" & Me.txtToolName.Text & "' " & _
" ,CategoryID = '" & Me.ddlCategory.SelectedValue & "' " & _
" ,Brand = '" & Me.txtBrand.Text & "' " & _
" ,Qty = '" & Me.txtQtyTool.Text & "' " & _
" ,ReceiveDate = '" & Me.txtReceiveDate.Text & "' " & _
" ,InsuranceDate = '" & Me.txtInsuranceDate.Text & "' " & _
" ,DepartmentID = '" & Me.ddlDepartment.SelectedValue & "' " & _
" ,CompanyID = '" & Me.ddlCompany.SelectedValue & "' " & _
" ,ToolPic = '" & Me.Image1.ImageUrl & "' " & _
" WHERE ToolID = '" & Request.QueryString("ToolID") & "' "
Com = New SqlCommand
With Com
.Connection = Conn
.CommandText = strSQL
.CommandType = CommandType.Text
End With
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Tag : ASP.NET Web (ASP.NET)

|
ประวัติการแก้ไข 2014-05-21 12:51:07 2014-05-21 12:52:06
|
 |
 |
 |
 |
Date :
2014-05-21 12:44:25 |
By :
mangpore |
View :
754 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (ASP)
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
Try
tmpPictureName = FileUpload1.FileName
tmpPathFilePicture = "~/Mypic/" & tmpPictureName
Dim CurrentPath As String = Server.MapPath("~/Mypic/")
If FileUpload1.HasFile Then
CurrentPath += tmpPictureName
FileUpload1.SaveAs(CurrentPath)
tmpPathFilePicture = "~/Mypic/" & tmpPictureName
Else
tmpPathFilePicture = Image1.ImageUrl
End If
strSQL = "UPDATE tblTool SET " & _
" ToolID = '" & Me.lblToolID.Text & "' " & _
" ,ToolName = '" & Me.txtToolName.Text & "' " & _
" ,CategoryID = '" & Me.ddlCategory.SelectedValue & "' " & _
" ,Brand = '" & Me.txtBrand.Text & "' " & _
" ,Qty = '" & Me.txtQtyTool.Text & "' " & _
" ,ReceiveDate = '" & Me.txtReceiveDate.Text & "' " & _
" ,InsuranceDate = '" & Me.txtInsuranceDate.Text & "' " & _
" ,DepartmentID = '" & Me.ddlDepartment.SelectedValue & "' " & _
" ,CompanyID = '" & Me.ddlCompany.SelectedValue & "' " & _
" ,ToolPic = '" & Me.Image1.ImageUrl & "' " & _
" WHERE ToolID = '" & Request.QueryString("ToolID") & "' "
Com = New SqlCommand
With Com
.Connection = Conn
.CommandText = strSQL
.CommandType = CommandType.Text
.ExecuteNonQuery()
End With
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
|
 |
 |
 |
 |
Date :
2014-05-21 14:14:15 |
By :
CPU4Core |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
รูปภาพอะไรหรอครับ ??
|
 |
 |
 |
 |
Date :
2014-05-21 14:41:12 |
By :
CPU4Core |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|