|
|
|
เกิดerrorไม่รู้เพราะไรอ่าพี่ดูให้หน่อย ไม่รู้ code นี้เปงไงรันแล้วตอน insert มันเกิด error ตรงนี้อ่า |
|
|
|
|
|
|
|
ไม่รู้codeนี้เปงไงรันแล้วตอนinsertมันเกิดerrorตรงนี้อ่า
Code (ASP)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim sqlConnectionString As String
sqlConnectionString = WebConfigurationManager.ConnectionStrings("youareteacher").ToString()
Dim Conn As New SqlConnection(sqlConnectionString)
Conn.Open()
'Dim strConn As String = WebConfigurationManager.ConnectionStrings("Genius").ConnectionString
'Dim Conn As New SqlConnection(strConn)
' Conn.Open()
Dim ID As String
'ID = "Sc_" + date("U")
ID = "Sc_1234567890"
Dim Username = Session("Username")
Dim Password = Session("Pass")
Dim email = Session("Email")
Dim Name_Sc = Session("Name_Sc")
Dim Type_Sc = Session("Type_Sc")
Dim headmaster = Session("headmaster")
Dim headgroup = Session("headgroup")
Dim headsection = Session("headsection")
Dim connector = Session("connector")
Dim street = Session("street")
Dim Alley = Session("Alley")
Dim district = Session("district")
Dim boundary = Session("boundary")
Dim province = Session("province")
Dim tel_Sc = Session("tel_Sc")
Dim tel_connect = Session("tel_connect")
Dim fax = Session("fax")
' Dim encode As String = MD5(Session("Pass").ToString)
Dim sqlAdd As String
Dim comAdd As New SqlCommand
' Try
sqlAdd = "INSERT INTO school(ID_Sc,Username,Password,Name_Sc,ID_Type_Sc,headmaster,headgroup,headsection,connect,Street_Sc,Alley_Sc,District_Sc,Boundary_Sc,Province_Sc,Tel_Sc,Tel_connect,Fax_Sc,Email_Sc)"
sqlAdd &= "VALUES('" & ID.ToString & "',"
sqlAdd &= "'" & Username.ToString & "',"
sqlAdd &= "'" & Password.ToString & "',"
'sqlAdd &= "'" & encode.ToString & "',"
sqlAdd &= "'" & Name_Sc.ToString & "',"
sqlAdd &= "'" & Type_Sc.ToString & "',"
sqlAdd &= "'" & headmaster.ToString & "',"
sqlAdd &= "'" & headgroup.ToString & "',"
sqlAdd &= "'" & headsection.ToString & "',"
sqlAdd &= "'" & connector.ToString & "',"
sqlAdd &= "'" & street.ToString & "',"
sqlAdd &= "'" & Alley.ToString & "',"
sqlAdd &= "'" & district.ToString & "',"
sqlAdd &= "'" & boundary.ToString & "',"
sqlAdd &= "'" & province.ToString & "',"
sqlAdd &= "'" & tel_Sc.ToString & "',"
sqlAdd &= "'" & tel_connect.ToString & "',"
sqlAdd &= "'" & fax.ToString & "',"
sqlAdd &= "'" & email.ToString & "')"
comAdd = New SqlCommand(sqlAdd, Conn)
Conn.Open()
comAdd.ExecuteNonQuery()
Conn.Close()
MsgBox("เพิ่มข้อมูลเรียบร้อยแล้ว", MsgBoxStyle.OkOnly)
result.Text = "ระบบบันทึกข้อมูลของท่านเรียบร้อย เราจะติดต่อกลับไปที่ท่านภายหลัง"
End Sub
End Class
Tag : - - - -
|
|
|
|
|
|
Date :
2010-01-25 17:25:52 |
By :
LuckyStar |
View :
1147 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (VB.NET)
Dim Conn As SqlConnection = New SqlConnection(sqlConnectionString)
|
|
|
|
|
Date :
2010-01-25 18:58:55 |
By :
tungman |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่ได้อ่าพี่เปลี่ยนแล้วอะ
เปงแบบนี้เหมือนเดิมอ่ะ
|
|
|
|
|
Date :
2010-01-26 10:18:18 |
By :
LuckyStar |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คำสั่งการเชื่อมต่อ database ไม่ถูกต้องครับ
ลองใช้แบบนี้ดู
dim con as new sqlconnection("data source=servername;initial catalog=databasename;uid=username;pwd=yourpassword;")
|
|
|
|
|
Date :
2010-01-26 11:17:13 |
By :
Programmer ด้อยปัญญา |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|