Click here to Skip to main content
15,913,722 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Command prompt in vb.net need a tad bit more help Pin
offroaderdan1-Nov-09 4:09
offroaderdan1-Nov-09 4:09 
GeneralRe: Command prompt in vb.net need a tad bit more help Pin
Dave Kreskowiak1-Nov-09 8:33
mveDave Kreskowiak1-Nov-09 8:33 
GeneralRe: Command prompt in vb.net need a tad bit more help Pin
0x3c01-Nov-09 4:23
0x3c01-Nov-09 4:23 
GeneralRe: Command prompt in vb.net need a tad bit more help Pin
offroaderdan1-Nov-09 4:25
offroaderdan1-Nov-09 4:25 
QuestionDatagridview combined filter Pin
LuxCoder31-Oct-09 12:07
LuxCoder31-Oct-09 12:07 
QuestionUnbound Checkbox column in DataGridView Pin
LuxCoder31-Oct-09 11:55
LuxCoder31-Oct-09 11:55 
AnswerRe: Unbound Checkbox column in DataGridView Pin
Henry Minute31-Oct-09 12:17
Henry Minute31-Oct-09 12:17 
QuestionInserting values into DB Pin
LuxCoder31-Oct-09 11:44
LuxCoder31-Oct-09 11:44 
Hi
I am passing the following code to insert values in my DB table directly:

Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveButton.Click
        Using connection As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=D:\ProjectMW\MachineWale\MachineWale\DatabaseMW.mdf;Integrated Security=True;User Instance=True")
            Using command As New SqlClient.SqlCommand("INSERT INTO [MachineProfile] ([MachineID], [Category], [Type], [Brand], [Model], [Quantity], [SalePrice], [RentalRate], [ListingDate], [Agent], [Availability], [PurchaseDate], [Kmsrun], [HoursRun], [ChasisNo], [EngineNo], [OtherSpec], [WebEntry], [Ownership]) VALUES (@MachineID, @Category, @Type, @Brand, @Model, @Quantity, @SalePrice, @RentalRate, @ListingDate, @Agent, @Availability, @PurchaseDate, @Kmsrun, @HoursRun, @ChasisNo, @EngineNo, @OtherSpec, @WebEntry, @Ownership) where [MachineID] = '" & TextBox1.Text & "'", connection)

                command.Parameters.AddWithValue("@MachineID", TextBox1.Text)
                command.Parameters.AddWithValue("@Category", ComboBox2.Text)
                command.Parameters.AddWithValue("@kmsrun", TextBox10.Text)
                command.Parameters.AddWithValue("@Type", ComboBox3.Text)
                command.Parameters.AddWithValue("@Brand", ComboBox7.Text)
                command.Parameters.AddWithValue("@Model", ComboBox8.Text)
                command.Parameters.AddWithValue("@Quantity", TextBox7.Text)
                command.Parameters.AddWithValue("@SalePrice", TextBox17.Text)
                command.Parameters.AddWithValue("@RentalRate", TextBox18.Text)
                command.Parameters.AddWithValue("@ListingDate", TextBox19.Text)
                command.Parameters.AddWithValue("@Agent", ComboBox6.Text)
                command.Parameters.AddWithValue("@Availability", ComboBox4.Text)
                command.Parameters.AddWithValue("@PurchaseDate", DateTimePicker1.Value)
                command.Parameters.AddWithValue("@HoursRun", TextBox11.Text)
                command.Parameters.AddWithValue("@ChasisNo", TextBox12.Text)
                command.Parameters.AddWithValue("@EngineNo", TextBox13.Text)
                command.Parameters.AddWithValue("@OtherSpec", TextBox15.Text)
                command.Parameters.AddWithValue("@WebEntry", ComboBox5.Text)
                command.Parameters.AddWithValue("@Ownership", ComboBox1.Text)
                connection.Open()
                command.ExecuteNonQuery()
                MsgBox("Updated")

            End Using
        End Using
    End Sub


But i am getting this error after executing as:

Incorrect syntax near the keyword 'where'.

What could be possibly wrong?

LuxCoder
AnswerRe: Inserting values into DB Pin
Henry Minute31-Oct-09 12:05
Henry Minute31-Oct-09 12:05 
AnswerRe: Inserting values into DB Pin
Luc Pattyn31-Oct-09 12:06
sitebuilderLuc Pattyn31-Oct-09 12:06 
GeneralRe: Inserting values into DB Pin
LuxCoder31-Oct-09 12:11
LuxCoder31-Oct-09 12:11 
AnswerRe: Inserting values into DB Pin
Christian Graus31-Oct-09 12:08
protectorChristian Graus31-Oct-09 12:08 
GeneralRe: Inserting values into DB Pin
LuxCoder31-Oct-09 12:13
LuxCoder31-Oct-09 12:13 
GeneralRe: Inserting values into DB Pin
LuxCoder31-Oct-09 12:45
LuxCoder31-Oct-09 12:45 
QuestionMapWindowGIS Pin
hira0831-Oct-09 7:29
hira0831-Oct-09 7:29 
AnswerRe: MapWindowGIS Pin
DaveAuld31-Oct-09 7:40
professionalDaveAuld31-Oct-09 7:40 
GeneralRe: MapWindowGIS Pin
hira081-Nov-09 3:03
hira081-Nov-09 3:03 
GeneralRe: MapWindowGIS Pin
DaveAuld1-Nov-09 7:38
professionalDaveAuld1-Nov-09 7:38 
Questioncreate somthing like this see the example pl multi select Pin
neverpleat31-Oct-09 5:52
neverpleat31-Oct-09 5:52 
AnswerRe: create somthing like this see the example pl multi select Pin
Henry Minute31-Oct-09 6:07
Henry Minute31-Oct-09 6:07 
GeneralRe: create somthing like this see the example pl multi select Pin
neverpleat31-Oct-09 7:23
neverpleat31-Oct-09 7:23 
GeneralRe: create somthing like this see the example pl multi select Pin
Henry Minute31-Oct-09 10:22
Henry Minute31-Oct-09 10:22 
AnswerRe: create somthing like this see the example pl multi select Pin
Luc Pattyn31-Oct-09 6:27
sitebuilderLuc Pattyn31-Oct-09 6:27 
QuestionHow to clear multiple textboxes in a form (using vb.net) Pin
Luc Baetsle31-Oct-09 2:59
Luc Baetsle31-Oct-09 2:59 
AnswerRe: How to clear multiple textboxes in a form (using vb.net) Pin
Milad.Biroonvand31-Oct-09 3:06
Milad.Biroonvand31-Oct-09 3:06 

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.