Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL ADO.NET
This is Mohit k. Can anyone tell me how to attach database in ado.net project.
I have already created database and tables inside database in sql server..and have created forms in Ado.net. But i am unable to attach the database to my project..here I want to update the data in my database through my project..ie adding the data and delete the data etc through binding navigator....so pls help me..and provide me the solution
Posted 1-Jul-12 6:58am
Edited 1-Jul-12 23:56pm
v2
Comments
Shemeer NS at 1-Jul-12 12:08pm
   
are you working in win form or web form?
Mohit_007 at 1-Jul-12 12:09pm
   
windows
Shemeer NS at 1-Jul-12 12:51pm
   
OK...
Damith Weerasinghe at 1-Jul-12 12:19pm
   
if you have already created database on your sql server why you want to attach it?
You only need to create connection to that database you created on sql server
Mohit_007 at 1-Jul-12 12:22pm
   
yes i have created the conn but after that what to do...should i create new data source?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

I think this article will give you all the required information and sample code to perform the CRUD operations using ADO.NET
 
A Beginner's Tutorial for Understanding ADO.NET[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Check out the Devfusion article here[^] it discusses the ADO.NET and more details like executing commands too if you want.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

You can refer this codeproject article
 
Add, Edit, and Delete in DataGridView with Paging
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

create a connection using SqlConnection class and then you can fire queries using SqlCommand or DataAdapter. Hope this will solve your problem.
  Permalink  
Comments
Mohit_007 at 2-Jul-12 4:54am
   
i have created that conn string but i am getting error on line
"SqlDataReader dr = cmd.ExecuteReader(); "
hari19113 at 3-Jul-12 13:16pm
   
It would be good if you could show the snippet for the same.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 390
1 Jochen Arndt 165
2 Richard MacCutchan 135
3 DamithSL 95
4 Garth J Lancaster 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 2 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100