I
Ivan V via DotNetMonster.com
Dear All:
I got a serious problem in updating the date field from vb.net to abd dbf
file. My code is as follow:
Dim ConnectionString As String
Dim cake As Date = Date.Parse(idate)
Console.WriteLine(Format(cake, "MM/dd/yyyy"))
ConnectionString = "Provider=vfpoledb;Data Source=g:\project\
cashier\data\cashier.dbc;" & _
"Mode=ReadWrite|Share Deny None;" & _
"Collating Sequence=MACHINE;" & _
"Password=''"
Dim dBaseConnection As New System.Data.OleDb.OleDbConnection
(ConnectionString)
dBaseConnection.Open()
Dim dBaseCommand As New System.Data.OleDb.OleDbCommand("update
caslip set ref_no = " & "'" & ref.Text$ & "'" & _
" ," & "inv_amt = " & CDec(inv_amt.Text) & _
" ," & "inv_dt = " & "'" & (cake) & "'" & _
" ," & "pro_no = " & "'" & f_no & "'" & _
" ," & "dep_no = " & "'" & d_no & "'" & _
" ," & "can_ind = " & p_tick & _
" ," & "cus_code = " & "'" & ser.Text & "'"
& _
" ," & "cash_amt = " & CDec(cash.Text) & _
" ," & "c_amt = " & CDec(c_card.Text) & _
" ," & "ent_amt = " & CDec(ent.Text) & _
" ," & "c_code = " & "'" & type.Text & "'" &
_
" ," & "c_chg = " & CDec(o_chr.Text) & _
" ," & "hou_amt = " & CDec(h_use.Text) & _
" ," & "remark = " & "'" & rmk.Text & "'" &
_
" ," & "oth_amt = " & CDec(other.Text) & _
" ," & "net_amt = " & CDec(dep_amount.Text)
& _
" ," & "dis_amt = " & CDec(discount.Text) &
_
" ," & "doc_no = " & "'" & ofi_no.Text & "'"
& _
" ," & "doc_dt = " & "'" & dt.Text & "'" & _
" where inv_no = " & "'" & think & "'",
dBaseConnection)
Dim vr As System.Data.OleDb.OleDbDataReader = dBaseCommand.
ExecuteReader(CommandBehavior.CloseConnection)
dBaseConnection.Close()
vr.Close()
this coding works fine on every part except when i put in the date filed, it
gave me the error message "Data Type Mismatch". I did test every single field
from the code, and I realized that it's the date format problem. Anyone has a
solution on that?? Thanks for the help!!~
I got a serious problem in updating the date field from vb.net to abd dbf
file. My code is as follow:
Dim ConnectionString As String
Dim cake As Date = Date.Parse(idate)
Console.WriteLine(Format(cake, "MM/dd/yyyy"))
ConnectionString = "Provider=vfpoledb;Data Source=g:\project\
cashier\data\cashier.dbc;" & _
"Mode=ReadWrite|Share Deny None;" & _
"Collating Sequence=MACHINE;" & _
"Password=''"
Dim dBaseConnection As New System.Data.OleDb.OleDbConnection
(ConnectionString)
dBaseConnection.Open()
Dim dBaseCommand As New System.Data.OleDb.OleDbCommand("update
caslip set ref_no = " & "'" & ref.Text$ & "'" & _
" ," & "inv_amt = " & CDec(inv_amt.Text) & _
" ," & "inv_dt = " & "'" & (cake) & "'" & _
" ," & "pro_no = " & "'" & f_no & "'" & _
" ," & "dep_no = " & "'" & d_no & "'" & _
" ," & "can_ind = " & p_tick & _
" ," & "cus_code = " & "'" & ser.Text & "'"
& _
" ," & "cash_amt = " & CDec(cash.Text) & _
" ," & "c_amt = " & CDec(c_card.Text) & _
" ," & "ent_amt = " & CDec(ent.Text) & _
" ," & "c_code = " & "'" & type.Text & "'" &
_
" ," & "c_chg = " & CDec(o_chr.Text) & _
" ," & "hou_amt = " & CDec(h_use.Text) & _
" ," & "remark = " & "'" & rmk.Text & "'" &
_
" ," & "oth_amt = " & CDec(other.Text) & _
" ," & "net_amt = " & CDec(dep_amount.Text)
& _
" ," & "dis_amt = " & CDec(discount.Text) &
_
" ," & "doc_no = " & "'" & ofi_no.Text & "'"
& _
" ," & "doc_dt = " & "'" & dt.Text & "'" & _
" where inv_no = " & "'" & think & "'",
dBaseConnection)
Dim vr As System.Data.OleDb.OleDbDataReader = dBaseCommand.
ExecuteReader(CommandBehavior.CloseConnection)
dBaseConnection.Close()
vr.Close()
this coding works fine on every part except when i put in the date filed, it
gave me the error message "Data Type Mismatch". I did test every single field
from the code, and I realized that it's the date format problem. Anyone has a
solution on that?? Thanks for the help!!~