| | |
ado.net
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
hi,
i am trying to create a database driven application using Sql2005 and c#.. i have alittle problem
can anyone tell me how to connect to sql database using c# and do simple transactions such as insert update delete and search ...but it shud be fully code based.
if possible please provide a sample.....
i am trying to create a database driven application using Sql2005 and c#.. i have alittle problem
can anyone tell me how to connect to sql database using c# and do simple transactions such as insert update delete and search ...but it shud be fully code based.
if possible please provide a sample.....
•
•
•
•
but it shud be fully code based.
Best of luck with http://msdn.com
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Just as MSDN is a fine source of information so is Google. Typed in ADO.NET, look what I found!
http://www.codeproject.com/KB/databa...thAdoNet1.aspx
http://www.codeproject.com/KB/databa...thAdoNet1.aspx
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Make love, no war. Cave ab homine unius libri.
Danny
•
•
Join Date: Feb 2009
Posts: 3
Reputation:
Solved Threads: 0
•
•
•
•
hi,
i am trying to create a database driven application using Sql2005 and c#.. i have alittle problem
can anyone tell me how to connect to sql database using c# and do simple transactions such as insert update delete and search ...but it shud be fully code based.
if possible please provide a sample.....
listen with first create database in sql with
create database command
-------------------
after dat when u r writing code in ur .net window
create connection then
open the connection
create command()
set the command type property(in this u have to write select ,insert,delete stt whatever u want)
at last if u want to read something then make datareader object and specify the columns which u made in the sql table
or if uwant to insert ,delete or update something then
simply write---
command object which u made above.execute nonquery
dats it
•
•
Join Date: Feb 2008
Posts: 46
Reputation:
Solved Threads: 4
you can read this:
http://www.csharp-station.com/Tutori.../Lesson01.aspx
http://www.csharp-station.com/Tutori.../Lesson01.aspx
•
•
Join Date: Sep 2008
Posts: 1
Reputation:
Solved Threads: 0
•
•
•
•
hi,
i am trying to create a database driven application using Sql2005 and c#.. i have alittle problem
can anyone tell me how to connect to sql database using c# and do simple transactions such as insert update delete and search ...but it shud be fully code based.
if possible please provide a sample.....
First add Using System.SqlClient; namespace to your cs file.
Then write connection string like this
//Connection String
SqlConnection conn = new SqlConnection("data source=<NameOfYourSqlServerInstance>;Initial catalog=<NameOfYourDataBase>; username = <UserName>; password =<Password>;Integrated Security=True");
//Insert Method
SqlConnection conn = new SqlConnection("data source=<NameOfYourSqlServerInstance>;Initial catalog=<NameOfYourDataBase>; username = <UserName>; password =<Password>;Integrated Security=True");
SqlCommand cmd = new SqlCommand("InsertQuery",conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
//Update Method
SqlConnection conn = new SqlConnection("data source=<NameOfYourSqlServerInstance>;Initial catalog=<NameOfYourDataBase>; username = <UserName>; password =<Password>;Integrated Security=True");
SqlCommand cmd = new SqlCommand("UpdateQuery",conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
//Delete Method
SqlConnection conn = new SqlConnection("data source=<NameOfYourSqlServerInstance>;Initial catalog=<NameOfYourDataBase>; username = <UserName>; password =<Password>;Integrated Security=True");
SqlCommand cmd = new SqlCommand("DeleteQuery",conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
![]() |
Similar Threads
- link access table in ADO.NET (VB.NET)
- How good is ADO.NET vNext CTP now? (C#)
- Saving Excel Spreadsheet using ADO.net gives inconsistent results (C#)
- DataGrid with ado.net. (VB.NET)
- Long ado net question but urgent help required (ASP.NET)
- ADO.NET question modification. (VB.NET)
- ADO.Net SQL UPDATE using OleDBAdapter (C#)
- Can i do something international using which side of vb.net whether it is ado.net, we (VB.NET)
- Data Navigation in textboxes with ADO.NET (like ADO) (ASP.NET)
Other Threads in the C# Forum
- Previous Thread: input from user help
- Next Thread: how to call C# dll in vc ++ project
| Thread Tools | Search this Thread |
.net access activedirectory ado.net algorithm array barchart bitmap box broadcast buttons c# check checkbox client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development disabled displayingopenforms draganddrop drawing encryption enum event excel exectuable file files form format forms ftp function gdi+ httpwebrequest image index index-error input install java label list listbox listener mandelbrot math mathematics mouseclick mysql operator path photoshop picturebox pixelinversion post prime programming radians regex remote remoting richtextbox serialization server setup sleep socket sql statistics stream string table tcp text textbox thread time timer update user usercontrol validation visualstudio webbrowser windows winforms wpf xml






