Data Type Not Consistent In MS Access? (Set new field as "TEXT" but system treats it as "Yes/No" field)
Posted
by
user3522506
on Stack Overflow
See other posts from Stack Overflow
or by user3522506
Published on 2014-06-11T03:13:25Z
Indexed on
2014/06/11
3:25 UTC
Read the original article
Hit count: 105
I already have an SQL command that will insert any string in the field. But it doesn't accept any string, giving me "No value given for one or more required parameters".
But if my string is "Yes" or "No", it will update successfully. And in MS Access, will appear as 0 or -1 even though I set the field as text even in the beginning.
Could there be any configuration I have made in my MS Access 2007?
con = New OleDbConnection(cs)
con.Open()
Dim cb As String = "Update FS_Expenses set FS_Date=#" & dtpDate2.Text & "#,SupplierID='" & txtSupplierID.Text & "', TestField=" & Label1.Text & " where ID=" & txtID2.Text & ""
cmd = New OleDbCommand(cb)
cmd.Connection = con
cmd.ExecuteReader()
MessageBox.Show("Successfully updated!", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information)
con.Close()
TestField is already a TEXT data type, Label1.Text value is "StringTest", will give the error.
However, set Label1.Text value as = "Yes", SQL will execute successfully. Therefore, field must have not been saved as TEXT.
© Stack Overflow or respective owner