问题描述
公共子插入(ByVal cls As clsregistration)
尝试
cnn =新ol.OleDbConnection
cnn.ConnectionString =新clsconnection( ).getcnnstring
cnn.Open()
cmd =新的ol.OleDbCommand
cmd.Connection = cnn
cmd.CommandText =插入registration_n值(&_
&cls.eno&,&_
'&cls.fname& ',&_
'&cls.lname&',&_
'&FormatDateTime(cls.addmission_date,DateFormat.ShortDate) &',&_
'&FormatDateTime(cls.dob,DateFormat.ShortDate)&',&_
'&cls。宗教&',&_
'&cls.gender&',&_
'&cls.class1&', &_
'&cls.section&',&_
'&cls.semester&',&_
'&cls.session&',&_
'&cls。 father_name&',&_
'&cls.father_occupatio&',&_
'&cls.address&', &_
&cls.phno&,&_
&cls.mobile&,&_
'&cls.email&',&_
&cls.discount&,&_
&cls.adm_fee& ,&_
&cls.dev_fee&,&_
&cls.security_fee&,&_
'&cls.dayHostel&',
cmd.ExecuteNonQuery()
MsgBox(记录保存成功,MsgBoxStyle.Information)
cnn.Close()
Catch ex As Exception
MsgBox(ex.Message)
结束尝试
End Sub
Public Sub fill_session(ByVa
Public Sub insert(ByVal cls As clsregistration)
Try
cnn = New ol.OleDbConnection
cnn.ConnectionString = New clsconnection().getcnnstring
cnn.Open()
cmd = New ol.OleDbCommand
cmd.Connection = cnn
cmd.CommandText = "insert into registration_n values(" & _
"" & cls.eno & "," & _
"'" & cls.fname & "'," & _
"'" & cls.lname & "'," & _
"'" & FormatDateTime(cls.addmission_date, DateFormat.ShortDate) & "'," & _
"'" & FormatDateTime(cls.dob, DateFormat.ShortDate) & "'," & _
"'" & cls.religion & "'," & _
"'" & cls.gender & "'," & _
"'" & cls.class1 & "'," & _
"'" & cls.section & "'," & _
"'" & cls.semester & "'," & _
"'" & cls.session & "'," & _
"'" & cls.father_name & "'," & _
"'" & cls.father_occupatio & "'," & _
"'" & cls.address & "'," & _
"" & cls.phno & "," & _
"" & cls.mobile & "," & _
"'" & cls.email & "'," & _
"" & cls.discount & "," & _
"" & cls.adm_fee & "," & _
"" & cls.dev_fee & "," & _
"" & cls.security_fee & "," & _
"'" & cls.dayHostel & "',"
cmd.ExecuteNonQuery()
MsgBox("Record saved successfully ", MsgBoxStyle.Information)
cnn.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Public Sub fill_session(ByVa
推荐答案
Public Sub insert(ByVal cls As clsregistration)
Try
cnn = New ol.OleDbConnection
cnn.ConnectionString = New clsconnection().getcnnstring
cnn.Open()
cmd = New ol.OleDbCommand
cmd.Connection = cnn
cmd.CommandText = "insert into registration_n values(" & _
"" & cls.eno & "," & _
"'" & cls.fname & "'," & _
"'" & cls.lname & "'," & _
"'" & FormatDateTime(cls.addmission_date, DateFormat.ShortDate) & "'," & _
"'" & FormatDateTime(cls.dob, DateFormat.ShortDate) & "'," & _
"'" & cls.religion & "'," & _
"'" & cls.gender & "'," & _
"'" & cls.class1 & "'," & _
"'" & cls.section & "'," & _
"'" & cls.semester & "'," & _
"'" & cls.session & "'," & _
"'" & cls.father_name & "'," & _
"'" & cls.father_occupatio & "'," & _
"'" & cls.address & "'," & _
"" & cls.phno & "," & _
"" & cls.mobile & "," & _
"'" & cls.email & "'," & _
"" & cls.discount & "," & _
"" & cls.adm_fee & "," & _
"" & cls.dev_fee & "," & _
"" & cls.security_fee & "," & _
"'" & cls.dayHostel & "' )"
cmd.ExecuteNonQuery()
MsgBox("Record saved successfully ", MsgBoxStyle.Information)
cnn.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
这篇关于insert into中的语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!