我在代码里向Access数据库里插入记录时,在向一个文本字段的内容超过了255的长度,后来我把那个字段类型改备注型,还是提示字段宽度太小无法插入记录。可是直接在Access那里输入那段字符串,可以输入。而且ACCess的帮助说明了备注字段可以输入65,535个字符。
请问这是什么问题?如何解决?
谢谢谢谢谢!!!!!!!!!!!!!!!!!!!!!!!!!!
楼上的,不是在控制中不能输入这么字符,而是在文本框里输入的字符不能保存入数据库
这是代码
Dim Conn As New OleDb.OleDbConnection
Dim Cmd As New OleDb.OleDbCommand
If Make_Flag = False Then
MessageBox.Show("没有生成任何票据,请在生成后保存!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Exit Sub
End If
Dim qs_date As String = Strings.Replace(Strings.Left(Me.DTP_qsrq.Value.ToString, Int(Strings.InStr(6, Me.DTP_qsrq.Value.ToString, "-")) - 1), "-", "年") & "月" '截取起始缴费日期
Dim zz_date As String = Strings.Replace(Strings.Left(Me.DTP_zzrq.Value.ToString, Int(Strings.InStr(6, Me.DTP_zzrq.Value.ToString, "-")) - 1), "-", "年") & "月" '截取终止缴费日期
If Save_Flag = False Then
Cmd.CommandText = "insert into bill_info(bill_id,bill_qsrq,bill_zzrq,bill_fkdw,bill_fkrq,bill_fklx,bill_date,bill_bz) values(" & Max_billid + 1 & ",'" & qs_date & "','" & zz_date & "','" & Me.Ttb_fkdw.Text & "',#" & Today.Date() & "#," & Me.jf_flag.SelectedIndex.ToString & ",#" & Date.Now & "#,'" & Me.Ttb_bz.Text & "')"
ElseIf Save_Flag = True Then
Cmd.CommandText = "update bill_info set bill_qsrq='" & qs_date & "',bill_zzrq='" & zz_date & "',bill_fkdw='" & Me.Ttb_fkdw.Text & "',bill_fkrq=#" & Today.Date() & "#,bill_fklx=" & Me.jf_flag.SelectedIndex & ",bill_date=#" & Date.Now & "#,bill_bz='" & Me.Ttb_bz.Text & "' where bill_id=" & Max_billid + 1
End If
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Application.StartupPath & "\DB\db.mdb; User Id=admin; Password=; "
Conn.Open()
Cmd.Connection = Conn
Cmd.ExecuteReader()
MessageBox.Show("恭喜,成功保存!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
Save_Flag = True '更改保存标志
就是最后一个字段bill_bz字段,这个字段原来是文本的类型,现在改成了备注型的
内容是由文本框输入的,可是一但超过50个汉字还是不能保存