Ok, try doing this entirely in VB instead of your SQL. Try this instead,
Admit_Date = system.convert.todatetime(dateTimeString). It may well be that
the SQL function you are calling in your VB code is not getting 'fired' in
SQL. Alternately, set a stored proc in the database and pass your date
string in as a parameter. One of these approaches should work. Of note, date
time is always a bear with proceedural languages to and DBMS. Never seems to
want to go smoothly <wink>.
Shout back the result.
Thanks for the reply Rico! My thoughts exactly were to do the same, go
through VB. But now I have another problem. First here is my code:
Dim ds As DataSet = Nothing
Dim dtachg As System.Data.SqlServerCe.SqlCeDataAdapter = Nothing
Dim cn As System.Data.SqlServerCe.SqlCeConnection = Nothing
cn = CMClientGlobals.CM_Database.EstablishConnection()
If cn.State = ConnectionState.Closed Then
cn.Open()
End If
dtachg = New System.Data.SqlServerCe.SqlCeDataAdapter
dtachg.SelectCommand = New SqlCeCommand
dtachg.SelectCommand.Connection = cn
dtachg.SelectCommand.CommandText = "Select * from Charges where
TRANSID = " & ENC_NUM
ds = New DataSet
dtachg.FillSchema(ds, SchemaType.Source, "Charges")
dtachg.Fill(ds, "Charges")
Dim dt As DataTable = ds.Tables(0)
If dt.Rows.Count = 1 Then
Dim dr As DataRow
dr = dt.Rows(0)
dr.BeginEdit()
dr("provider") = Provider
dr("Facility_Code") = Facility_Code
dr("dx1") = Dx1
dr("dx2") = Dx2
dr("dx3") = Dx3
dr("dx4") = Dx4
dr("dos") = Admit_Date
dr("chargecode") = ChargeCode
dr.EndEdit()
Dim objCommandBuilder As New SqlCeCommandBuilder(dtachg)
dtachg.UpdateCommand = objCommandBuilder.GetUpdateCommand
dtachg.Update(ds, "charges")
end if
now I am getting the error:
An unhandled exception of type 'System.InvalidOperationException' occurred
in System.Data.SqlServerCe.dll
Additional information: Dynamic SQL generation for the UpdateCommand is not
supported against a SelectCommand that does not return any key column
information.
I have tried setting the primarykey with dt.primarykey = "TRANSID", but I
continue to get the same error.
Any thoughts
> Ok, try doing this entirely in VB instead of your SQL. Try this instead,
> Admit_Date = system.convert.todatetime(dateTimeString). It may well be that
[quoted text clipped - 32 lines]
> > > >
> > > > Dale
TnCoder - 25 Aug 2005 19:44 GMT
I forgot to mention that the "TRANSID" was set in an array when I tried to
make it the primary key
> Thanks for the reply Rico! My thoughts exactly were to do the same, go
> through VB. But now I have another problem. First here is my code:
[quoted text clipped - 83 lines]
> > > > >
> > > > > Dale