Click here to Skip to main content
15,911,786 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Startup Program Pin
CWIZO1-May-06 23:49
CWIZO1-May-06 23:49 
AnswerRe: Startup Program Pin
Hari Om Prakash Sharma2-May-06 1:30
Hari Om Prakash Sharma2-May-06 1:30 
Questioncrystal reports Pin
skippydog1-May-06 23:19
skippydog1-May-06 23:19 
Questioncustom control question Pin
batmike20001-May-06 22:02
batmike20001-May-06 22:02 
QuestionDLL Hell in VB Pin
D.N.1-May-06 20:19
D.N.1-May-06 20:19 
AnswerRe: DLL Hell in VB Pin
Christian Graus1-May-06 20:58
protectorChristian Graus1-May-06 20:58 
AnswerRe: DLL Hell in VB Pin
Duncan Edwards Jones1-May-06 21:10
professionalDuncan Edwards Jones1-May-06 21:10 
QuestionUnable to add object to database Pin
jackwongcw1-May-06 19:22
jackwongcw1-May-06 19:22 
Dear All,

I always encounter syntax error on INSERT TO.

I am sure my code is correct but I do not know where go wrong.

Below is my code.

Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click
Me.Cursor = Cursors.WaitCursor
Dim row As DataRow = dataTable.Rows(currRec)

txtdatefrom.Text = datestart.Value.Date.ToString
txtdateto.Text = DateEnd.Value.Date.ToString

row.BeginEdit()

row("Ship_Name") = ComboBox1.SelectedItem
row("Container") = Container_SizeTextBox.Text
row("datefrom") = txtdatefrom.Text
row("dateto") = txtdateto.Text
row("DateCreate") = Date.Today

row.EndEdit()
dataAdapter.Update(ds, "shipment")
ds.AcceptChanges()

ToggleControls(True)
btnnew.Enabled = True
insertSelected = False
Me.Cursor = Cursors.Default
MsgBox("Record Created")
End Sub

Private Sub InitializeCommands()
' Preparing Insert SQL Command
dataAdapter.InsertCommand = conn.CreateCommand()
dataAdapter.InsertCommand.CommandText = "INSERT INTO shipment " + _
"( Ship_Name, Container, datefrom, dateto, DateCreate)" + _
"VALUES( @Ship_Name, @Container, @datefrom, @dateto, @DateCreate)"
AddParams(dataAdapter.InsertCommand, "Ship_Name", "Container", "datefrom", "dateto", "DateCreate")
end sub

Private Sub AddParams(ByVal cmd As OleDbCommand, ByVal ParamArray cols() As String)

' Adding Hectice parameters in SQL Commands
Dim col As String
For Each col In cols
cmd.Parameters.Add("@" + col, OleDbType.WChar, 0, col)
Next
End Sub

Can anyone please advise.

Thank in advance....Sigh | :sigh:

Jack Wong
QuestionCant get images from a webserver thru a proxy socket Pin
Abhishek Tiwari1-May-06 18:59
Abhishek Tiwari1-May-06 18:59 
QuestionPrint to File Pin
furjaw1-May-06 18:52
furjaw1-May-06 18:52 
AnswerRe: Print to File Pin
Duncan Edwards Jones1-May-06 21:15
professionalDuncan Edwards Jones1-May-06 21:15 
GeneralRe: Print to File Pin
furjaw2-May-06 8:34
furjaw2-May-06 8:34 
GeneralRe: Print to File Pin
Duncan Edwards Jones2-May-06 9:48
professionalDuncan Edwards Jones2-May-06 9:48 
GeneralRe: Print to File Pin
furjaw2-May-06 10:10
furjaw2-May-06 10:10 
GeneralRe: Print to File Pin
furjaw3-May-06 19:50
furjaw3-May-06 19:50 
Questionsplit string using vb6 Pin
ihsan_zie1-May-06 17:09
ihsan_zie1-May-06 17:09 
AnswerRe: split string using vb6 Pin
atregent1-May-06 17:51
atregent1-May-06 17:51 
Question'System.Data.DataRowView' does not contain a property with the name LastDate. Pin
kenn_rosie1-May-06 16:48
kenn_rosie1-May-06 16:48 
Questiondeclare and error Pin
ezajan1-May-06 15:11
ezajan1-May-06 15:11 
AnswerRe: declare and error Pin
Christian Graus1-May-06 16:02
protectorChristian Graus1-May-06 16:02 
GeneralRe: declare and error Pin
ezajan1-May-06 16:16
ezajan1-May-06 16:16 
GeneralRe: declare and error Pin
Christian Graus1-May-06 17:08
protectorChristian Graus1-May-06 17:08 
Question.NET Security Question Pin
mlauahi1-May-06 12:51
mlauahi1-May-06 12:51 
QuestionHow can I programatically add a record in an Excel sheet? Pin
DoubleD8221-May-06 8:24
DoubleD8221-May-06 8:24 
QuestionDataGridView & ComboboxCell Pin
MasySh1-May-06 6:59
MasySh1-May-06 6:59 

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.