Click here to Skip to main content
15,894,646 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
Hello,

Can anyone tell me please how to create database in windows application and how to retrieve it.
Thnx

Regards,
Vishavdeep Goyal
Posted
Comments
[no name] 30-Jun-11 9:16am    
Your question is not very clear. What exactly is it you want to do?

Yes.


Any particular type of database? MsSQL, MySQL, SQLCE, SqlLite, Oracle,...
Anything you want to put in it, in particular?
Anything you want to do with it when you retrieve it?

Have you tried reading your lecture notes?
Have you considered Google?

Have you actually done anything at all yourself?
 
Share this answer
 
You need to try something like this:


C#
using (SqlConnection con = new SqlConnection(@"Data Source=yourServerName\SQLEXPRESS;Integrated Security=True;"))
           {
               SqlCommand cmd = new SqlCommand("CREATE DATABASE MyDataBase",con);
               con.Open();
               cmd.ExecuteNonQuery();
           }


Hope this helps
 
Share this answer
 
 
Share this answer
 
v6
Comments
fjdiewornncalwe 30-Jun-11 10:23am    
Just fixed so that your link works...
charles henington 30-Jun-11 10:28am    
Thanks was playing around with the backcolor to set to a light green but made a mistake got it fixed now thanks

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900