.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 28th, 2002, 10:42 AM
gsnt gsnt is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 1 gsnt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Create database and tables with ADO.NET

I always see examples about using insert, delete, update SQL commands but how can I launch SQL server and use 'create database' or 'create table' commands from within my .NET windows apps (users of these apps are not supposed to know how to launch SQL server and create databases) ?
Thanks
G.

Reply With Quote
  #2  
Old September 1st, 2003, 11:54 AM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 785 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 17
A sql statement inside the console or manager of SQL server is a sql statement embedded in your code. Obviously the difference lies in the fact that in code you surround everything with quotes, but other than that there is no difference.

Your question leads me to believe you are not very experienced in SQL server itself, not the particular programming language that you chose.

You should take a little time to familiarize yourself with SQL server or read some tutorials on SQL server rather than the programming language as a client for SQL server. From there you should have no problem doing whatever you want in SQL server from you code.

Hope everything works out for you.
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #3  
Old May 21st, 2007, 12:01 AM
ABHI_developer ABHI_developer is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 4 ABHI_developer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 5 m 17 sec
Reputation Power: 0
'create table' commands from within my .NET windows apps

Quote:
Originally Posted by gsnt
I always see examples about using insert, delete, update SQL commands but how can I launch SQL server and use 'create database' or 'create table' commands from within my .NET windows apps (users of these apps are not supposed to know how to launch SQL server and create databases) ?
Thanks
G.


First thing to tell u that while connection to front end to back end u need a connection string in connection string u have to provide servername , databasename , user id and password of server then connect to the server then in that databse u can create table inert table delete table all.
and also one process u have to find the database name if not exsit then create it

Reply With Quote
  #4  
Old September 3rd, 2010, 01:12 AM
SNK111 SNK111 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2010
Posts: 14 SNK111 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 4 m 30 sec
Reputation Power: 0
Connecting and executing queries in SQL Server

To connect to SQL Server from C#.NET, you need to create a connection string such as below:

private SqlConnection connection;
private string connectionString =
@"Server=(local);Database=Embedding_SQL_Test;User ID=sa;Password=123";
connection = new SqlConnection( connectionString );

Next, you use the SqlConnection object created above to create a 'SqlCommand', as shown below:
SqlCommand cmd = new SqlCommand( "select * from Customer where CustomerID = @Cid", connection);

The SQL query shown here can be replaced by a SELECT, INSERT, UPDATE queries etc.

Next to execute the SQL queries in the database, you use the following methods:
ExecuteReader - to execute SELECT queries
ExecuteNonQuery - to execute INSERT, DELETE, UPDATE, and SET statements.

This is a very short description of how to connect to SQL Server database from C# and execute SQL queries in the database.
For details about the connection string, the methods and their parameters check the following link: ( http://www.shahriarnk.com/Shahriar-...Sharp-Java.html )
Here you will also find details about how to pass parameters to the SQL queries as well as calling stored procedures and much more.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > Create database and tables with ADO.NET


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap