Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 11th, 2006, 9:10 PM   #1
taporctv
Newbie
 
Join Date: Mar 2006
Posts: 20
Rep Power: 0 taporctv is on a distinguished road
SQL and vb.net

Having trouble adding to a DataTable with my vb.net program. The following code is used to change a value in the DataTable Houses.
[PHP]
Private Sub changeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles changeButton.Click
editForm.Text = "Change Record"
If editForm.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dim dev As String = editForm.developmentComboBox.SelectedValue.ToString
Dim bedrooms As String = editForm.bedroomsTextBox.Text
Dim price As String = editForm.priceTextBox.Text.Replace("$", "").Replace(",", "")
Dim mls As String = editForm.mlsNumberTextBox.Text

If dev <> "" And bedrooms <> "" And price <> "" And mls <> "" Then
sqlStr = "Update Houses Set Development = " & dev & " Where [MLS Number]='" & mls & "'"
runActionQuery(sqlStr)
sqlStr = "Update Houses Set Bedrooms = " & bedrooms & " Where [MLS Number]='" & mls & "'"
runActionQuery(sqlStr)
sqlStr = "Update Houses Set Price = " & price & " Where [MLS Number]='" & mls & "'"
runActionQuery(sqlStr)
togglebuttons()
runQuery()
Else
Dim msg As String = "Required data is missing. No action taken."
MessageBox.Show(msg, "Error", MessageBoxButtons.OK)
End If

End If
End Sub
[/PHP]

I'm trying to add a completely new entry into the DataTable
[PHP]
If editForm.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dim dev As String = editForm.developmentComboBox.SelectedValue.ToString
Dim bedrooms As String = editForm.bedroomsTextBox.Text
Dim price As String = editForm.priceTextBox.Text.Replace("$", "").Replace(",", "")
Dim mls As String = editForm.mlsNumberTextBox.Text

If dev <> "" And bedrooms <> "" And price <> "" And mls <> "" Then


sqlStr = "Insert Into Houses Set Development = " & dev & ""
runActionQuery(sqlStr)
sqlStr = "INSERT INTO Houses Bedrooms = " & bedrooms & " "
runActionQuery(sqlStr)
sqlStr = "INSERT INTO Houses Price = " & price & " "
runActionQuery(sqlStr)
sqlStr = "INSERT INTO Houses MLS = " & mls & " "
togglebuttons()
runQuery()
End If

End If
[/PHP]
The compiler is telling me a have a syntax error in my INSERT INTO statement
taporctv is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:35 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC