我將客戶端信息插入到VB.Net 2010的MySql數據庫中找到的客戶端表中。 所有值都正確插入。 問題是當它插入值時,MySql Date列顯示:「0000-00-00」。從VB.Net中保存日期和時間mysql數據庫日期?
我輸入正確後我需要做什麼?
這是代碼:
Dim dtb, dtr As DateTime
DateTimePicker1.Format = DateTimePickerFormat.Custom
DateTimePicker1.CustomFormat = "yyyy-mm-dd"
dtb = DateTimePicker1.MinDate
txtdtb.AppendText(dtb)
DateTimePicker2.Format = DateTimePickerFormat.Custom
DateTimePicker2.CustomFormat = "yyyy-mm-dd"
dtr = DateTimePicker1.MinDate
ExecSQL("INSERT INTO clients VALUES('" & clid.Text & "','" & clname.Text & "','" & clgen.Text & "','" & dtb & "','" & claddress.Text & "','" & clemail.Text & "','" & clphone.Text & "','" & clocp.Text & "','" & dtr & "')")
MsgBox("Record Saved", MsgBoxStyle.Information, "Save")
FillList(frmMember.lvMember, GetData("SELECT * FROM clients"))
End If
啊!這裏是SQL注入的好機會。 – equisde