Database Question [modified]
-
First, I am using sql statement to create table like "CREATE TABLE"; I have several tables to create with a lot of fields and I find out it is very inconvenient to do. I keep getting sentax error and it takes me time to fix. I want to know if there is any other way to do that if I don't wnat to do the wizard. Does microsoft access provides a translator for sql. Assume that I have the table in access, can it gives me the correspondent sql statement for that table? The sedcond question I have, I also wnat to create an access file (.mdb) for that table. Right now I have to create an empty file than put the table to it. I mean an empty access file from ms access. So how can I create an access file here is the way I do it
OleDbConnection dbConnection; dbConnection = new OleDbConnection(); string tableName = "Table Name"; dbConnection.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; " + "Data Source = " + Application.StartupPath + "\\EmptyFile.mdb";
show how can I use the OleDbConnection to create a new access file before I put any table to it also how to autoincrement the primary field or set it to true? -- modified at 13:53 Friday 8th December, 2006 -
First, I am using sql statement to create table like "CREATE TABLE"; I have several tables to create with a lot of fields and I find out it is very inconvenient to do. I keep getting sentax error and it takes me time to fix. I want to know if there is any other way to do that if I don't wnat to do the wizard. Does microsoft access provides a translator for sql. Assume that I have the table in access, can it gives me the correspondent sql statement for that table? The sedcond question I have, I also wnat to create an access file (.mdb) for that table. Right now I have to create an empty file than put the table to it. I mean an empty access file from ms access. So how can I create an access file here is the way I do it
OleDbConnection dbConnection; dbConnection = new OleDbConnection(); string tableName = "Table Name"; dbConnection.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; " + "Data Source = " + Application.StartupPath + "\\EmptyFile.mdb";
show how can I use the OleDbConnection to create a new access file before I put any table to it also how to autoincrement the primary field or set it to true? -- modified at 13:53 Friday 8th December, 2006Sorry if this sounds rather blunt, but, for a beginner, you are trying to do stuff that is too advanced. Suggest that your take your time learning the basics using those on-line tutorials that I pointed you towards before you try anything more complicated. When you have learned the basics (don't expect to run before you can walk), you can then think about learning more advanced stuff or you will end up being totally confused. Two good books for you to study after you have learned the basics are ... (1) Programming SQL Server 2005. By Bill Hamilton. Publisher : O'Reilly (2) Microsoft SQL Server 2005 Stored Procedure Programming in T-SQL & .NET, Third Edition. by Dejan Šunderi. Publisher : McGraw-Hill/Osborne