|
|
|
ASP.NET ขอโค้ด การเพิ่มข้อมุลสมาชิก ขอโค้ดเพิ่มข้อมูล การสมัครสมาชิก ลงในฐานข้อมูล sql sever 2005 หน่อยค่ะ |
|
|
|
|
|
|
|
Insert ตามปกติครับ
Code (VB.NET)
Sub btnSave_Click(sender As Object, e As EventArgs)
Dim objConn As New SqlConnection
Dim objCmd As New SqlCommand
Dim strConnString,strSQL As String
strConnString = "Server=localhost;UID=sa;PASSWORD=;database=mydatabase;Max Pool Size=400;Connect Timeout=600;"
strSQL = "INSERT INTO customer (CustomerID,Name,Email,CountryCode,Budget,Used) " & _
" VALUES " & _
" ('" & Me.txtCustomerID.Text & "','" & Me.txtName.Text & "','" & Me.txtEmail.Text & "', " & _
" '" & Me.txtCountryCode.Text & "','" & Me.txtBudget.Text & "','" & Me.txtUsed.Text & "')"
objConn.ConnectionString = strConnString
objConn.Open()
With objCmd
.Connection = objConn
.CommandText = strSQL
.CommandType = CommandType.Text
End With
Me.pnlAdd.Visible = False
Try
objCmd.ExecuteNonQuery()
Me.lblStatus.Text = "Record Inserted"
Me.lblStatus.Visible = True
Catch ex As Exception
Me.lblStatus.Visible = True
Me.lblStatus.Text = "Record can not insert Error ("& ex.Message &")"
End Try
objConn.Close()
objConn = Nothing
End Sub
Go to : ASP.NET SQL Server Add/Insert Record
|
|
|
|
|
Date :
2011-08-10 20:32:29 |
By :
thaicreate |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|