hi mudassar thanks for ur reply,i need to display the employee id by company type..i tried like this it show an error,input string wat not in correct format
this is my code,its show an error input string wat not in correct format
Dim connection As New SqlConnection
Dim cmd As New SqlCommand
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
connection.ConnectionString = ("Data Source=RIFAYEE-PC;Initial Catalog=trial;Integrated Security=True;Pooling=False")
connection.Open()
cmd = New SqlCommand("insert into employee values('" + TextBox1.Text.Trim() + "','" + TextBox2.Text.Trim() + "'," + TextBox3.Text.Trim() + ")", connection)
cmd.ExecuteNonQuery()
connection.Close()
label1.Text = "Records successfully Inserted"
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Dim con As New SqlConnection(strConnString)
connection.ConnectionString = ("Data Source=RIFAYEE-PC;Initial Catalog=trial;Integrated Security=True;Pooling=False")
Dim count As Integer
cmd = New SqlCommand("select count(*)from employee", connection)
connection.Open()
count = Convert.ToInt16(cmd.ExecuteScalar()) + 1
TextBox1.Text = "OAD"+count
connection.Close()
End Sub