Click here to Skip to main content
16,008,490 members
Home / Discussions / C#
   

C#

 
QuestionMulti-database support using databindings Pin
sailchris2225-May-07 10:37
sailchris2225-May-07 10:37 
QuestionCreating Access Database in C# VS2005 Pin
brickbat25-May-07 8:54
brickbat25-May-07 8:54 
AnswerRe: Creating Access Database in C# VS2005 Pin
Not Active25-May-07 9:37
mentorNot Active25-May-07 9:37 
GeneralRe: Creating Access Database in C# VS2005 Pin
brickbat26-May-07 6:40
brickbat26-May-07 6:40 
GeneralRe: Creating Access Database in C# VS2005 Pin
Not Active26-May-07 7:05
mentorNot Active26-May-07 7:05 
GeneralRe: Creating Access Database in C# VS2005 Pin
brickbat26-May-07 9:34
brickbat26-May-07 9:34 
GeneralRe: Creating Access Database in C# VS2005 Pin
Not Active26-May-07 12:22
mentorNot Active26-May-07 12:22 
GeneralRe: Creating Access Database in C# VS2005 [modified] Pin
brickbat26-May-07 19:57
brickbat26-May-07 19:57 
You are right. I did find several references to it and I can't get them to work. Here is where I got.

         <br />
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Data.SqlClient;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
<br />
namespace Project<br />
{<br />
    public partial class Form1 : Form<br />
    {<br />
        public Form1()<br />
        {<br />
            InitializeComponent();<br />
            toolStripStatusLabel1.Text = "";<br />
        }<br />
        public void NewStatus()<br />
        {<br />
<br />
        }<br />
        public void CreateDatabase()<br />
        {<br />
            string sCreateDatabase = "CREATE DATABASE Projectdb9";        <br />
            SqlConnection mycon = new SqlConnection();<br />
            mycon.ConnectionString = "Data Source=.\\SQLEXPRESS;Integrated Security=True;Connect Timeout=30;User Instance=True";<br />
<br />
            SqlCommand mycomm = new SqlCommand();<br />
            mycomm.CommandType = CommandType.Text;<br />
            mycomm.CommandText = sCreateDatabase;<br />
            mycomm.Connection = mycon;<br />
<br />
            try<br />
            {<br />
                //	Open the connection<br />
                mycon.Open();<br />
                //	Execute CreateDatabase query<br />
                mycomm.ExecuteNonQuery();<br />
            }<br />
            catch<br />
            {<br />
                //	Catch any errors and show the error message<br />
                toolStripStatusLabel1.Text = "Database Creation Error ";<br />
            }<br />
            finally<br />
            {<br />
                mycon.Close();<br />
            }<br />
<br />
        }<br />
<br />
        private void newToolStripMenuItem_Click(object sender, EventArgs e)<br />
        {<br />
            CreateDatabase();<br />
        }<br />
<br />
        private void Form1_Load(object sender, EventArgs e)<br />
        {<br />
<br />
        }	<br />
    }<br />
}<br />


But I know its wrong. Firstly, I can't figure out where to set the path. In all the references I found, I can't find anything about setting the path so I think I am creating an SQL database on an SQL server which is NOT what I want. Thats why I didn't post my code straight away. I would rather get a simple answer to my question instead of people being confused about what I want by my code and fixing it but still leaving me with the wrong solution.

n instead of people being confused about what I want by my code and fixing it but still leaving me with the wrong solution.
GeneralRe: Creating Access Database in C# VS2005 Pin
brickbat27-May-07 2:45
brickbat27-May-07 2:45 
GeneralRe: Creating Access Database in C# VS2005 Pin
Not Active27-May-07 4:55
mentorNot Active27-May-07 4:55 
GeneralRe: Creating Access Database in C# VS2005 Pin
brickbat27-May-07 5:14
brickbat27-May-07 5:14 
GeneralRe: Creating Access Database in C# VS2005 Pin
Paul Conrad27-May-07 7:01
professionalPaul Conrad27-May-07 7:01 
GeneralRe: Creating Access Database in C# VS2005 Pin
Not Active27-May-07 5:00
mentorNot Active27-May-07 5:00 
GeneralRe: Creating Access Database in C# VS2005 Pin
brickbat27-May-07 19:51
brickbat27-May-07 19:51 
AnswerRe: Creating Access Database in C# VS2005 Pin
brickbat27-May-07 22:16
brickbat27-May-07 22:16 
GeneralRe: Creating Access Database in C# VS2005 Pin
brickbat27-May-07 22:20
brickbat27-May-07 22:20 
QuestionQuestion regarding Image displayed in a Button. Pin
Khoramdin25-May-07 8:48
Khoramdin25-May-07 8:48 
AnswerRe: Question regarding Image displayed in a Button. Pin
Martin#25-May-07 9:02
Martin#25-May-07 9:02 
AnswerRe: Question regarding Image displayed in a Button. Pin
Ian Shlasko25-May-07 10:39
Ian Shlasko25-May-07 10:39 
Questionsend SMS with UMTS modem in application Pin
spotl25-May-07 8:27
spotl25-May-07 8:27 
QuestionId and its Details Pin
Mikeyyy25-May-07 8:16
Mikeyyy25-May-07 8:16 
AnswerRe: Id and its Details Pin
Mikeyyy25-May-07 8:18
Mikeyyy25-May-07 8:18 
GeneralRe: Id and its Details Pin
Tarakeshwar Reddy25-May-07 8:26
professionalTarakeshwar Reddy25-May-07 8:26 
GeneralRe: Id and its Details Pin
Martin#25-May-07 8:43
Martin#25-May-07 8:43 
GeneralRe: Id and its Details Pin
Colin Angus Mackay25-May-07 9:10
Colin Angus Mackay25-May-07 9:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.