Imports System.Data.SqlClient Imports System.Data.SqlClient.SqlConnection Public Class Form1 Dim cn As SqlConnection Dim ConStr As String Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ConStr = "Data Source=ANAND-PC\SQLEXPRESS;Initial Catalog=anand;User ID=;Password=" cn = New SqlConnection(ConStr) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim cmd As New SqlClient.SqlCommand Dim query As String query = "Insert Into anand1 (roll) values (" & TextBox1.Text & ");" cmd.CommandText = query cmd.CommandType = CommandType.Text cmd.Connection = cn cn.Open() cmd.ExecuteNonQuery() cn.Close() End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)