![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Mar 2006
Posts: 20
Rep Power: 0
![]() |
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|