Click here to Skip to main content
15,900,258 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionGeneric code for updating business object from dataset - feedback requested Pin
Lee Ludden13-Jan-10 9:37
Lee Ludden13-Jan-10 9:37 
AnswerWow, way to complicated ... Pin
David Mujica13-Jan-10 9:57
David Mujica13-Jan-10 9:57 
QuestionHow to generate a check sum string? Pin
azusakt12-Jan-10 18:02
azusakt12-Jan-10 18:02 
AnswerRe: How to generate a check sum string? Pin
Abhinav S12-Jan-10 18:37
Abhinav S12-Jan-10 18:37 
GeneralRe: How to generate a check sum string? Pin
azusakt12-Jan-10 19:14
azusakt12-Jan-10 19:14 
GeneralRe: How to generate a check sum string? Pin
Johan Hakkesteegt12-Jan-10 22:05
Johan Hakkesteegt12-Jan-10 22:05 
AnswerRe: How to generate a check sum string? Pin
Luc Pattyn12-Jan-10 23:23
sitebuilderLuc Pattyn12-Jan-10 23:23 
QuestionError inserting a date into an SqlCe DataTable Pin
Paul Hasler12-Jan-10 13:47
Paul Hasler12-Jan-10 13:47 
Yes, Ok, I know this is a common problem, but I've read through a lot of similar threads and still can't seem to see what I'm doing wrong. Confused | :confused:
Some fresh eyes might see what is probably staring me in the face.

I've written the following sub to insert a record into an SqlCe database DataTable called BRDataTable.
On executing sqlInsert.ExecuteNonQuery() near the end of the code, I get an error message "There was an error in a part of the date format.".

I've put a breakpoint at sqlInsert.ExecuteNonQuery for debugging, and checked the contents of sqlInsert.CommandText, which is:

"INSERT INTO BRDataTable VALUES('Test', '13/01/2010', '', '', '1', '7', '0', '0')"

I've also tried setting CurrentRecord.WhenReady as DateTime instead of just Date, giving the following CommandText, but I still get the same error:

"INSERT INTO BRDataTable VALUES('Test', '13/01/2010 11:08:40 AM', '', '', '1', '7', '0', '0')"

I've double checked, and the DataType for the second column in the DataTable is definitely set to DateTime.

Thanks in advance.
Paul

Private Sub AddCurrentRecordToDatabase()

    '#####################################################
    '# Add the contents of CurrentRecord to the database #
    '#####################################################

    'Make a connection to the database
    Dim sqlConn As New SqlCeConnection(sqlConnString)

    'Set up the insert command
    Dim sqlInsert As SqlCeCommand = sqlConn.CreateCommand

    sqlInsert.CommandText = "INSERT INTO BRDataTable VALUES('" _
    & CurrentRecord.Name & "', '" _
    & CurrentRecord.WhenReady & "', '" _
    & CurrentRecord.Address & "', '" _
    & CurrentRecord.Notes & "', '" _
    & ConvertBooleanToBit(CurrentRecord.Reminder) & "', '" _
    & CurrentRecord.DaysWarning & "', '" _
    & ConvertBooleanToBit(CurrentRecord.Acknowledged) & "', '" _
    & CurrentRecord.Age & "')"

    'Execute the insert command
    sqlConn.Open()
    sqlInsert.ExecuteNonQuery()
    sqlConn.Close()

End Sub

AnswerRe: Error inserting a date into an SqlCe DataTable Pin
Andy_L_J12-Jan-10 16:10
Andy_L_J12-Jan-10 16:10 
GeneralRe: Error inserting a date into an SqlCe DataTable Pin
Paul Hasler12-Jan-10 17:14
Paul Hasler12-Jan-10 17:14 
AnswerI've got it working but I'm still confused Pin
Paul Hasler12-Jan-10 18:14
Paul Hasler12-Jan-10 18:14 
GeneralRe: I've got it working but I'm still confused Pin
_Damian S_12-Jan-10 20:53
professional_Damian S_12-Jan-10 20:53 
AnswerRe: Error inserting a date into an SqlCe DataTable Pin
Dave Kreskowiak12-Jan-10 18:29
mveDave Kreskowiak12-Jan-10 18:29 
GeneralRe: Error inserting a date into an SqlCe DataTable Pin
Paul Hasler13-Jan-10 2:40
Paul Hasler13-Jan-10 2:40 
QuestionCover a form and it no longer updates Pin
Gregory Gadow12-Jan-10 12:53
Gregory Gadow12-Jan-10 12:53 
AnswerRe: Cover a form and it no longer updates Pin
Luc Pattyn12-Jan-10 13:14
sitebuilderLuc Pattyn12-Jan-10 13:14 
GeneralRe: Cover a form and it no longer updates Pin
Gregory Gadow13-Jan-10 3:41
Gregory Gadow13-Jan-10 3:41 
GeneralRe: Cover a form and it no longer updates Pin
Luc Pattyn13-Jan-10 3:49
sitebuilderLuc Pattyn13-Jan-10 3:49 
GeneralRe: Cover a form and it no longer updates Pin
Tom Deketelaere13-Jan-10 3:58
professionalTom Deketelaere13-Jan-10 3:58 
GeneralRe: Cover a form and it no longer updates Pin
Gregory Gadow13-Jan-10 5:15
Gregory Gadow13-Jan-10 5:15 
GeneralRe: Cover a form and it no longer updates Pin
Tom Deketelaere13-Jan-10 5:27
professionalTom Deketelaere13-Jan-10 5:27 
GeneralRe: Cover a form and it no longer updates Pin
Luc Pattyn13-Jan-10 5:31
sitebuilderLuc Pattyn13-Jan-10 5:31 
GeneralRe: Cover a form and it no longer updates Pin
Gregory Gadow13-Jan-10 5:57
Gregory Gadow13-Jan-10 5:57 
GeneralRe: Cover a form and it no longer updates Pin
Tom Deketelaere13-Jan-10 3:57
professionalTom Deketelaere13-Jan-10 3:57 
GeneralRe: Cover a form and it no longer updates Pin
Gregory Gadow13-Jan-10 5:18
Gregory Gadow13-Jan-10 5:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.