connect to database
I am using vb.net and I try to insert from my web in visual studio to my sql DB
but it does not work also there is no any Error
pleas help me
"
Imports System.Data
Imports System.Data.SqlClient
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
Dim con As New SqlConnection("Data Source=HALOMRAN-LT\SQLEXPRESS;Initial Catalog=soha;Integrated Security=True ;User Instance=True")
Dim show As String = TextBox2.Text + "/" + DropDownList1.SelectedValue + "/" + DropDownList3.SelectedValue + "/" + DropDownList4.SelectedValue + "/" + TextBox3.Text
Try
'con.ConnectionString = "Data Source= HALOMRAN-LT\SQLEXPRESS; " & _
' "Database= soha ; " & _
'" Integrated Security=true;" & _
'" Persist Security Info=False;"
Dim com As New SqlCommand
com.CommandType = CommandType.Text
com.Connection = con
con.Open()
com.CommandText = "INSERT INTO print(title,number-of-print,name-of-sector,number-of-sector,typ-of-print,form-of-print,time,edition,notes) VALUES (@v1,@v2,@v3,@v4,@v5,@v6,@v7,@v8,@v9)"
com.Parameters.AddWithValue("@v1", TextBox1.Text)
com.Parameters.AddWithValue("@v2", TextBox2.Text)
com.Parameters.AddWithValue("@v3", DropDownList2.SelectedValue)
com.Parameters.AddWithValue("@v4", DropDownList1.SelectedValue)
com.Parameters.AddWithValue("@v5", DropDownList3.SelectedValue)
com.Parameters.AddWithValue("@v6", DropDownList4.SelectedValue)
com.Parameters.AddWithValue("@v7", TextBox3.Text)
com.Parameters.AddWithValue("@v8", TextBox4.Text)
com.Parameters.AddWithValue("@v9", TextBox5.Text)
com.ExecuteNonQuery()
Catch ex As Exception
MsgBox(show)
Finally
con.Close()
End Try
End Sub
End Class