User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 423,340 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 5,172 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 410 | Replies: 1
Reply
Join Date: Jun 2008
Posts: 25
Reputation: preethi_ga is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
preethi_ga preethi_ga is offline Offline
Light Poster

Insert,Update,Delete codings.

  #1  
Jun 25th, 2008
Hi,
Im using ASP.NET with back end as SQL Server. Im using VB language coding. here if in insert button im writing coding like this...

[ com = new SqlCommand("insert into emp values(" & Textbox1.Text & ", ' " & Textbox2.Text & " ', " & Textbox3.Text & " ", con) ]
[ con.Open() ]
[ com.ExecuteNonQuery() ]
[ Response.write " One record inserted " ]

here textbox1 and 3 contains onlu numeric values. and textbox2 has string value.
con is Sqlconnection. and com is SqlCommand declared in page load. i donno whats wrong with this?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2006
Location: India
Posts: 125
Reputation: bala24 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 11
bala24's Avatar
bala24 bala24 is offline Offline
Junior Poster

Re: Insert,Update,Delete codings.

  #2  
Jun 25th, 2008
The statement
con.Open()
has to come before
com = new SqlCommand("insert into emp values(" & Textbox1.Text & ", ' " & Textbox2.Text & " ', " & Textbox3.Text & " ", con)

This got to make it work.
Michelangelo

"The best place to find a helping hand is at the end of your own arm"
Reply With Quote  
Reply

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

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 11:44 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC