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 422,555 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 4,683 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

Error connecting to database

Join Date: Nov 2005
Posts: 23
Reputation: Reham Ejaz is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Reham Ejaz Reham Ejaz is offline Offline
Newbie Poster

Re: Error connecting to database

  #7  
Jan 31st, 2006
Originally Posted by f1 fan
you havent written an insert, update or delete query. Just a select query. your cmd is a "select" command it ONLY knows about getting data. You need a new command for each of the CRUD actions you intend to do (you should in theory write one for each but if you know 100% you will never need a delete then you can leave it out). So you cannot call Update on a command whos SQL is a SELECT query.

Create a new command but this time an Insert Command (with Inser INTO sql or the name of an insert stored proc or query in your database.

I would recommend you use a data adapter and fill all 4 commands in and use this to do everything you need.

If you need more explanation let me know

The command builder object sees the changes in our data set and automatically makes the changes accordingly in the datastore. So with it we dont need insert statement.
Reply With Quote  
All times are GMT -4. The time now is 1:01 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC