Advertisement
Advertisement
| 06.06.2008 at 05:45PM PDT, ID: 23465449 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: |
Dim conn As New SqlConnection("Data Source=RICK-PC\SQLEXPRESS;" + "Initial Catalog=greypanther;" + "Integrated Security=True;") 'Using integrated security to connect, since SQL connection is playing up.
Try
Dim cmd As New SqlCommand 'SqlCommand declared, allows us to send commands to server.
Dim params As SqlParameterCollection = cmd.Parameters
cmd.CommandTimeout = 5
cmd.Connection = conn 'Hooks into the declared SqlConnection.
cmd.CommandType = CommandType.Text 'Tells SqlCommand we're going to be using simple text based SQL queries.
conn.Open() 'Opens the SQL connection.
If conn.State = ConnectionState.Open Then
cmd.CommandText = "INSERT INTO Customers VALUES ('" + ComboBox1.Text + "', '" + TextBox1.Text + "', '" + TextBox2.Text + "', '" + TextBox4.Text + "', '" + _
TextBox5.Text + "', '" + TextBox6.Text + "', '" + TextBox7.Text + "', '" + TextBox11.Text + "', '" + TextBox12.Text + "', '" + TextBox11.Text + "', '" + _
TextBox10.Text + "', '" + TextBox9.Text + "', '" + RadioButton1.Checked.ToString + "', '" + NumericUpDown1.Value.ToString + "', '" + TextBox8.Text + "', '" + _
TextBox16.Text + "', '" + TextBox13.Text + "', '" + TextBox19.Text + "', '" + (TextBox18.Text + TextBox17.Text) + "', '" + (TextBox15.Text + TextBox14.Text) + "', '" + ComboBox2.Text + "')"
cmd.ExecuteNonQuery()
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error) 'Report exception.
End Try
conn.Close() 'Closes SQL connection.
|