hi everyone,
iam a newbie in asp.net.even it sounds silly doubt to u ,plz help me.i want parameters in a sql query to insert a record.i wrote the program like this,but iam not able to insert the data.so,plz say my mistake .
Dim str As String

con = New SqlConnection("user id=sa;password=;data source=charan;database=master")
command = New SqlCommand(str, con)
command.Parameters.Add(New SqlParameter(" @empid ", TextBox1.Text))
command.Parameters.Add(New SqlParameter("@empname", TextBox2.Text))
command.Parameters.Add(New SqlParameter("@salary", TextBox3.Text))
command.Parameters.Add(New SqlParameter("@comm", TextBox4.Text))
str = "insert into employees(empid,empname,salary,comm)values (@empid,@empname,@salary,@comm)"
con.Open()
command.ExecuteNonQuery()
da = New SqlDataAdapter("select distinct * from employees ", con)
da.Fill(ds, "employees")
GridView1.DataSource = ds
GridView1.DataBind()
con.Close()

What is the error that you get?

hi,
iam not getting any error but iam not able insert my record.any help appreciated

data source=charan;database=master

What is this?
You are updating master database. :-O

This is no good.
I recommend tutorials for beginners.

I the meantime, try using this:

Server=SERVER_NAME;Database=DATABASE_NAME;Trusted_Connection=True
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.