Click here to Skip to main content
16,005,209 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralLogin using VB.NET Pin
aspnet2312-Mar-08 11:45
aspnet2312-Mar-08 11:45 
GeneralImage Resizing - Webserver Effect Pin
cbjroms12-Mar-08 9:40
cbjroms12-Mar-08 9:40 
GeneralDLL Problems Pin
parth.p12-Mar-08 8:27
parth.p12-Mar-08 8:27 
GeneralRe: DLL Problems Pin
Nilesh Hapse12-Mar-08 21:17
Nilesh Hapse12-Mar-08 21:17 
QuestionHow to protect from past onto textbox? Pin
phowarso12-Mar-08 6:32
phowarso12-Mar-08 6:32 
AnswerRe: How to protect from past onto textbox? Pin
Xmen Real 12-Mar-08 6:54
professional Xmen Real 12-Mar-08 6:54 
GeneralDataGridView , Expression and Calculation Problem [modified] Pin
fearless stallion12-Mar-08 5:02
fearless stallion12-Mar-08 5:02 
GeneralTime stamp insert into database Pin
Cory Kimble12-Mar-08 4:24
Cory Kimble12-Mar-08 4:24 
I don't know why I am having so much trouble with this. It is only a simple insert into a database. Can someone help me with this. I am so frustrated and the answer is probably staring me in the face.

I want to get the current date in my VB.net desktop program. I then want to insert the date along with an ID and the location. I have tried doing this a number of different ways. But it is not formatting the date correct in the database.


Breakdown:
Code:
Dim shipTo As String = "Test"<br />
        Dim dateInv As Date<br />
        Dim ID As String = "11111"<br />
        Dim command As New OleDbCommand<br />
        dateInv = Today<br />
        <br />
<br />
        <br />
        command.CommandText = "Insert INTO [Physical_Inventory] VALUES(" + shipTo + ", " + ID + "," +                                                       dateInv.toShortDate() + ")"<br />
        command.Connection = connection<br />
<br />
        command.Parameters.Add("ShipTo", OleDbType.VarChar, 20, shipTo)<br />
        command.Parameters.Add("ID", OleDbType.VarChar, 20, ID)<br />
        command.Parameters.Add("DateInv", OleDbType.DBDate, 20, dateInv.toShortDate)<br />
<br />
<br />
        command.Parameters("ShipTo").Value = shipTo<br />
        command.Parameters("ID").Value = ID<br />
        command.Parameters("DateInv").Value = dateInv<br />
<br />
        connection.Open()<br />
        command.ExecuteNonQuery()<br />
        connection.Close()


I am trying to update a Access Database and I get 12/30/1899 in the date field.

Can someone help me.

GeneralRe: Time stamp insert into database Pin
Parwej Ahamad12-Mar-08 6:25
professionalParwej Ahamad12-Mar-08 6:25 
GeneralRe: Time stamp insert into database [modified] Pin
Cory Kimble12-Mar-08 9:21
Cory Kimble12-Mar-08 9:21 
GeneralRe: Time stamp insert into database Pin
Parwej Ahamad12-Mar-08 17:28
professionalParwej Ahamad12-Mar-08 17:28 
GeneralRe: Time stamp insert into database Pin
Cory Kimble24-Mar-08 4:39
Cory Kimble24-Mar-08 4:39 
GeneralJanus Control GridEx - Performance Issue Pin
manowj12-Mar-08 3:04
manowj12-Mar-08 3:04 
GeneralRe: Janus Control GridEx - Performance Issue Pin
nlarson1112-Mar-08 9:55
nlarson1112-Mar-08 9:55 
GeneralReading text from Middle of the txt file Pin
Syed Ali Raza12-Mar-08 2:16
Syed Ali Raza12-Mar-08 2:16 
GeneralRe: Reading text from Middle of the txt file Pin
Xmen Real 12-Mar-08 2:48
professional Xmen Real 12-Mar-08 2:48 
GeneralRe: Reading text from Middle of the txt file Pin
Syed Ali Raza12-Mar-08 2:55
Syed Ali Raza12-Mar-08 2:55 
GeneralRe: Reading text from Middle of the txt file Pin
Xmen Real 12-Mar-08 3:02
professional Xmen Real 12-Mar-08 3:02 
GeneralRe: Reading text from Middle of the txt file Pin
AndrewVos12-Mar-08 3:06
AndrewVos12-Mar-08 3:06 
GeneralRe: Reading text from Middle of the txt file Pin
Syed Ali Raza12-Mar-08 3:14
Syed Ali Raza12-Mar-08 3:14 
AnswerRe: Reading text from Middle of the txt file Pin
AndrewVos12-Mar-08 3:19
AndrewVos12-Mar-08 3:19 
QuestionBlocking specific URLs Pin
Gjm12-Mar-08 1:11
Gjm12-Mar-08 1:11 
GeneralRe: Blocking specific URLs Pin
parth.p12-Mar-08 8:30
parth.p12-Mar-08 8:30 
GeneralRe: Blocking specific URLs Pin
ESTAN13-Mar-08 2:26
ESTAN13-Mar-08 2:26 
GeneralTextbox Multiple line Problem Pin
Vimalsoft(Pty) Ltd12-Mar-08 0:09
professionalVimalsoft(Pty) Ltd12-Mar-08 0:09 

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.