G
Guest
I am having some problems with getting squgglie lines under stringbuilder and
ConfigurationSettings
what am I doing wrong, is this even close to working? help.
------------------------------------------------------------------------------------
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.VisualBasic
Public Class Locations
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Private Sub Save_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Save.Click
Dim mySQLConnection As New
SqlConnection(ConfigurationSettings.AppSettings("DSN"))
Dim strSQLCommand As New StringBuilder, mySQLCommand As SqlCommand
strSQLCommand = New StringBuilder
With strSQLCommand
.Append("INSERT INTO Locations (Loc_Name, Address, ContactName,
Phone) ")
.Append("VALUES ('" & txtName.Text & "', '" & txtAddress.Text &
"', '" & txtContactName.Text & "', '" & txtPhone.Text & "');")
End With
mySQLConnection.Open()
mySQLCommand = New SqlCommand(strSQLCommand.ToString, mySQLConnection)
mySQLCommand.ExecuteNonQuery()
mySQLConnection.Close()
End Sub
End Class
ConfigurationSettings
what am I doing wrong, is this even close to working? help.
------------------------------------------------------------------------------------
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.VisualBasic
Public Class Locations
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Private Sub Save_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Save.Click
Dim mySQLConnection As New
SqlConnection(ConfigurationSettings.AppSettings("DSN"))
Dim strSQLCommand As New StringBuilder, mySQLCommand As SqlCommand
strSQLCommand = New StringBuilder
With strSQLCommand
.Append("INSERT INTO Locations (Loc_Name, Address, ContactName,
Phone) ")
.Append("VALUES ('" & txtName.Text & "', '" & txtAddress.Text &
"', '" & txtContactName.Text & "', '" & txtPhone.Text & "');")
End With
mySQLConnection.Open()
mySQLCommand = New SqlCommand(strSQLCommand.ToString, mySQLConnection)
mySQLCommand.ExecuteNonQuery()
mySQLConnection.Close()
End Sub
End Class