C#将控件内容添加进SQL数据库时类型不对,提示的是输入字符串的格式不正确

C#将控件内容添加进SQL数据库时类型不对,提示的是输入字符串的格式不正确,第1张

textBox1 只是控件的名称,而非是控件的值。应该是textBox1.Text

-》

dateTimePicker1.Value 这个数据格式不对吧??

Private Sub Form_Load()

Data1.Refresh

Dim i As Integer, istr As String

Text1 = ""

For i = 0 To Data1.Recordset.Fields.Count - 1

istr = istr &FieldType(Data1.Recordset.Fields(i).Type) &","

Next

Text1 = Left(istr, Len(istr) - 1)

End Sub

Function FieldType(intType As Integer) As String

Select Case intType

Case dbBoolean

FieldType = "dbBoolean"

Case dbByte

FieldType = "dbByte"

Case dbInteger

FieldType = "dbInteger"

Case dbLong

FieldType = "dbLong"

Case dbCurrency

FieldType = "dbCurrency"

Case dbSingle

FieldType = "dbSingle"

Case dbDouble

FieldType = "dbDouble"

Case dbDate

FieldType = "dbDate"

Case dbText

FieldType = "dbText"

Case dbLongBinary

FieldType = "dbLongBinary"

Case dbMemo

FieldType = "dbMemo"

Case dbGUID

FieldType = "dbGUID"

End Select

End Function

如果你的文本框是字符型的(默认),那么

repl 成绩 with val(allt(thisform.text1.value))

如果你的文本筐本来就是数值型的,那么

repl 成绩 with thisform.text1.value

如果还不对,那么,是不是你表中的成绩字段不是数值型的呀?


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11938819.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-19
下一篇 2023-05-19

发表评论

登录后才能评论

评论列表(0条)

保存