-
create a runtime table in Ms Access database
I want to create table at runtime for an existing Ms Access database using ASP.net 2.0 and C#.
Can anyone please guide me through it ?
Last edited by arpd2005; 12-11-2006 at 09:26 AM.
-
Paul
~~~~
Microsoft MVP (Visual Basic)
-
create a runtime table in Ms Access database
void createTable(string connString, string tableName)
{
try
{
OleDbConnection con = new OleDbConnection(connString);
OleDbCommand cmd = con.CreateCommand();
string cmdText = String.Format("CREATE TABLE {0} (dno int primary key, dname char(15), grade int, avg int)",tableName);
cmd.CommandType = CommandType.Text;
cmd.CommandText = cmdText;
con.Open();
cmd.ExecuteNonQuery();
}
catch (Exception e)
{
// Process error
log.Error("Exception occured", e);
}
finally
{
// Close connection if open
try { if (con != null) con.Close(); }
catch (Exception ex)
{
log.Warn("Unable to close connection - exception occured.", ex);
}
}
}
Similar Threads
-
Replies: 17
Last Post: 04-04-2003, 04:55 PM
-
By Ken in forum VB Classic
Replies: 5
Last Post: 09-16-2002, 01:03 PM
-
By Michelle in forum VB Classic
Replies: 8
Last Post: 04-19-2002, 05:01 PM
-
By Dave W in forum VB Classic
Replies: 5
Last Post: 10-26-2001, 11:29 AM
-
By Marcus in forum VB Classic
Replies: 1
Last Post: 01-06-2001, 09:48 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks