EddiRae
asked on
Visual Web Developer, VB, ERROR [22018] [Microsoft][ODBC Visual FoxPro Driver]Data type mismatch.
I have a website that I am using BLLs to insert new records into a Foxpro database accessing it with ODBC.
I am using the dataset and have the dates to be DATE types, not DATETIME. In the BLL is where I am placing the data into the record.
I thought the DATE datatype would automatically place the date correctly into any DATE field.
What do you suggest?
My INSERT function is below ...
I am using the dataset and have the dates to be DATE types, not DATETIME. In the BLL is where I am placing the data into the record.
I thought the DATE datatype would automatically place the date correctly into any DATE field.
What do you suggest?
My INSERT function is below ...
Public Function InsertStudent(ByVal stu_no As Decimal, _
ByVal office As String, _
ByVal lastname As String, _
ByVal firstname As String, _
ByVal mi As String, _
ByVal stu_status As String, _
ByVal status_date As Date, _
ByVal birthday As Date, _
ByVal sex As String, _
ByVal address As String, _
ByVal city As String, _
ByVal state As String, _
ByVal zip As String, _
ByVal parents As String, _
ByVal siblings As String, _
ByVal dl_number As String, _
ByVal dl_state As String, _
ByVal email As String, _
ByVal donot_send As Boolean, _
ByVal parent2 As String, _
ByVal dl_number2 As String, _
ByVal dl_state2 As String, _
ByVal email2 As String, _
ByVal donot_send1 As Boolean, _
ByVal type_address As String, _
ByVal address1 As String, _
ByVal city1 As String, _
ByVal state1 As String, _
ByVal zip1 As String, _
ByVal type_address1 As String, _
ByVal mail As String, _
ByVal referred As String, _
ByVal referred_by As Decimal, _
ByVal wphone As String, _
ByVal wphone_ext As String, _
ByVal cphone As String, _
ByVal hphone As String, _
ByVal beeper As String, _
ByVal fax As String, _
ByVal assistant As String, _
ByVal assistant_phone As String, _
ByVal policy_yr As Decimal, _
ByVal registra As Decimal, _
ByVal release As Date, _
ByVal physician As String, _
ByVal emerg_name As String, _
ByVal emerg_relat As String, _
ByVal emerg_phon1 As String, _
ByVal emerg_phon2 As String, _
ByVal hospital As String, _
ByVal credit_crd As String, _
ByVal credit_exp As String, _
ByVal cid As String, _
ByVal credit_pay As String, _
ByVal cash_dep As Decimal, _
ByVal auto_debit As String, _
ByVal method As String, _
ByVal method_dt As Date, _
ByVal total_due As Decimal, _
ByVal total_paid As Decimal, _
ByVal no_pmt_made As Decimal, _
ByVal times_per As Decimal, _
ByVal bonus_owed As Decimal, _
ByVal type_stu As String, _
ByVal expiration As Date, _
ByVal last_class As String, _
ByVal next_class As String, _
ByVal family As Decimal, _
ByVal begun As Date, _
ByVal begun_tm As String, _
ByVal begun_by As String, _
ByVal l_edit As Date, _
ByVal l_edit_tm As String, _
ByVal l_edit_by As String, _
ByVal medical As String, _
ByVal directions As String, _
ByVal photo_file As String, _
ByVal photo_file1 As String, _
ByVal photo_file2 As String, _
ByVal photo_file3 As String, _
ByVal photo_file4 As String, _
ByVal photo_file5 As String, _
ByVal photo_file6 As String, _
ByVal photo_file7 As String, _
ByVal photo_file8 As String, _
ByVal photo_file9 As String, _
ByVal attach1 As String, _
ByVal attach2 As String, _
ByVal attach3 As String, _
ByVal attach4 As String, _
ByVal attach5 As String, _
ByVal attach6 As String, _
ByVal attach7 As String, _
ByVal attach8 As String, _
ByVal attach9 As String, _
ByVal attach10 As String) As Boolean
Dim StudentsAdd As New dsSSMweb.StudentsDataTable
Dim StudentAdd As dsSSMweb.StudentsRow = StudentsAdd.NewStudentsRow
Dim dtDefault As Date = CDate("1/1/1900")
strMsg = Nothing
StudentAdd.office = Trim(office)
StudentAdd.lastname = PCase(Trim(lastname))
StudentAdd.firstname = PCase(Trim(firstname))
StudentAdd.mi = UCase(Trim(mi))
StudentAdd.stu_status = "Active"
StudentAdd.status_date = CDate(Format(Now(), "MM/dd/yyyy"))
'StudentAdd.status_date = dtDefault
If IsDate(birthday) Then
StudentAdd.birthday = CDate(Format(birthday, "MM/dd/yyyy"))
Else
StudentAdd.birthday = dtDefault
End If
StudentAdd.sex = Trim(sex)
StudentAdd.address = PCase(Trim(address))
StudentAdd.city = PCase(Trim(city))
StudentAdd.state = Trim(state)
StudentAdd.zip = Trim(zip)
StudentAdd.parents = PCase(Trim(parents))
StudentAdd.siblings = Space(1)
StudentAdd.dl_number = Trim(dl_number)
StudentAdd.dl_state = Trim(dl_state)
StudentAdd.email = Trim(email)
StudentAdd.donot_send = False
StudentAdd.parent2 = PCase(Trim(parent2))
StudentAdd.dl_number2 = Trim(dl_number2)
StudentAdd.dl_state2 = Trim(dl_state2)
StudentAdd.email2 = Trim(email2)
StudentAdd.donot_send1 = False
StudentAdd.type_address = Trim(type_address)
StudentAdd.address1 = Space(1)
StudentAdd.city1 = Space(1)
StudentAdd.state1 = Space(1)
StudentAdd.zip1 = Space(1)
StudentAdd.type_address1 = Space(1)
StudentAdd.mail = "P"
StudentAdd.referred = Trim(referred)
StudentAdd.referred_by = 0
StudentAdd.wphone = fixPhoneNbr(wphone)
StudentAdd.wphone_ext = Trim(wphone_ext)
StudentAdd.cphone = fixPhoneNbr(Trim(cphone))
StudentAdd.hphone = fixPhoneNbr(Trim(hphone))
StudentAdd.beeper = Space(1)
StudentAdd.fax = Space(1)
StudentAdd.assistant = Space(1)
StudentAdd.assistant_phone = Space(1)
StudentAdd.policy_yr = 0
StudentAdd.registra = 0
StudentAdd.release = dtDefault
StudentAdd.physician = Space(1)
StudentAdd.emerg_name = PCase(Trim(emerg_name))
StudentAdd.emerg_relat = PCase(Trim(emerg_relat))
StudentAdd.emerg_phon1 = fixPhoneNbr(Trim(emerg_phon1))
StudentAdd.emerg_phon2 = fixPhoneNbr(Trim(emerg_phon2))
StudentAdd.hospital = Space(1)
StudentAdd.credit_crd = Space(1)
StudentAdd.credit_exp = Space(1)
StudentAdd.cid = Space(1)
StudentAdd.credit_pay = Space(1)
StudentAdd.cash_dep = 0
StudentAdd.auto_debit = Space(1)
StudentAdd.method = Space(1)
StudentAdd.method_dt = dtDefault
StudentAdd.total_due = 0
StudentAdd.total_paid = 0
StudentAdd.no_pmt_made = 0
StudentAdd.times_per = 0
StudentAdd.bonus_owed = 0
StudentAdd.type_stu = Space(1)
StudentAdd.expiration = dtDefault
StudentAdd.last_class = Space(1)
StudentAdd.next_class = Space(1)
StudentAdd.family = 0
StudentAdd.begun = CDate(Format(Now(), "MM/dd/yyyy"))
StudentAdd.begun_tm = Format(Now(), "hh:mm")
StudentAdd.begun_by = "WEB"
StudentAdd.l_edit = CDate(Format(Now(), "MM/dd/yyyy"))
StudentAdd.l_edit_tm = Format(Now(), "hh:mm")
StudentAdd.l_edit_by = "WEB"
StudentAdd.medical = medical
StudentAdd.directions = Space(1)
StudentAdd.photo_file = Space(1)
StudentAdd.photo_file1 = Space(1)
StudentAdd.photo_file2 = Space(1)
StudentAdd.photo_file3 = Space(1)
StudentAdd.photo_file4 = Space(1)
StudentAdd.photo_file5 = Space(1)
StudentAdd.photo_file6 = Space(1)
StudentAdd.photo_file7 = Space(1)
StudentAdd.photo_file8 = Space(1)
StudentAdd.photo_file9 = Space(1)
StudentAdd.attach1 = Space(1)
StudentAdd.attach2 = Space(1)
StudentAdd.attach3 = Space(1)
StudentAdd.attach4 = Space(1)
StudentAdd.attach5 = Space(1)
StudentAdd.attach6 = Space(1)
StudentAdd.attach7 = Space(1)
StudentAdd.attach8 = Space(1)
StudentAdd.attach9 = Space(1)
StudentAdd.attach10 = Space(1)
Dim StudentIDTbl As dsSSMweb.SetupDataTable = Adapter1.GetSetupByStudentID
If StudentIDTbl.Count <> 1 Then
Throw New ApplicationException("Error in getting StudentID, Contact Website Administrator")
Return False
End If
Dim StudentIDRec As dsSSMweb.SetupRow = StudentIDTbl(0)
Dim intStudentID As Integer
intStudentID = CInt(Trim(StudentIDRec.value)) + 1
StudentAdd.stu_no = intStudentID
StudentIDRec.value = Format(intStudentID, "000000")
'update setup record
Adapter1.Update(StudentIDTbl)
'Add new students record
StudentsAdd.AddStudentsRow(StudentAdd)
Dim rowsAffected As Integer = Adapter.Update(StudentsAdd)
Return rowsAffected = 1
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.