RSS Forums RSS
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 606 | Replies: 3
Join Date: Apr 2007
Posts: 263
Reputation: greeny_1984 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 11
greeny_1984's Avatar
greeny_1984 greeny_1984 is offline Offline
Posting Whiz in Training

need u r help

  #1  
May 7th, 2007
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 AsString

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()
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:12 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC