Click here to Skip to main content
15,918,742 members
Home / Discussions / C#
   

C#

 
GeneralRe: Interface Problems Pin
Ox53746F6E6523-Mar-05 7:41
Ox53746F6E6523-Mar-05 7:41 
GeneralDispose Error Pin
JMichael246823-Mar-05 4:38
JMichael246823-Mar-05 4:38 
GeneralRe: Dispose Error Pin
mav.northwind23-Mar-05 6:04
mav.northwind23-Mar-05 6:04 
GeneralRe: Dispose Error Pin
JMichael246823-Mar-05 7:42
JMichael246823-Mar-05 7:42 
GeneralRe: Dispose Error Pin
mav.northwind23-Mar-05 19:10
mav.northwind23-Mar-05 19:10 
GeneralCreate table in access database Pin
webhay23-Mar-05 3:08
webhay23-Mar-05 3:08 
GeneralRe: Create table in access database Pin
mav.northwind23-Mar-05 6:14
mav.northwind23-Mar-05 6:14 
GeneralRe: Create table in access database Pin
webhay23-Mar-05 6:24
webhay23-Mar-05 6:24 
Hello Mav,

Thanks so much for your help.

I know that the SQL has a command :Create table
I mean how can i do this with Code dynamicaly i tried this code put it return error.
using System;<br />
using System.Data;<br />
using System.Data.OleDb;<br />
using System.IO;<br />
namespace FrameworkExamples<br />
{<br />
//HOW TO: use ADO.NET to execute sql against an MS Access DB<br />
class SampleADONETExecSQLAccess<br />
{<br />
static void Main()<br />
{<br />
OleDbConnection db;<br />
OleDbCommand dbcmd;<br />
string connstring;<br />
int recsaffected;<br />
StringWriter sql;<br />
//create the connection string to an access db<br />
connstring = "Provider=Microsoft.Jet.OLEDB.4.0;";<br />
connstring += @"Data Source=C:\Documents and Settings\Administrator\Desktop\db1.mdb;";<br />
//create a connection to an access db<br />
db = new OleDbConnection(connstring);<br />
//open access db<br />
db.Open();<br />
//create some sql to run<br />
sql = new StringWriter();<br />
sql.WriteLine("create table tbl1");<br />
sql.WriteLine("(");<br />
sql.WriteLine("id int identity(1, 1) not null primary key,");<br />
sql.WriteLine("field1 varchar(255) null,");<br />
sql.WriteLine("field2 bit null");<br />
sql.WriteLine(")");<br />
sql.Flush();<br />
//create a command object to run sql<br />
dbcmd = new OleDbCommand();<br />
//set type to text<br />
dbcmd.CommandType=CommandType.Text;<br />
//timeout of 30 seconds<br />
dbcmd.CommandTimeout=30;<br />
//the sql that was created above<br />
dbcmd.CommandText=sql.ToString();<br />
//set to the current OleDbConnection instance<br />
dbcmd.Connection=db;<br />
//execute sql that doesn't return rows<br />
recsaffected = dbcmd.ExecuteNonQuery();<br />
//close access database<br />
db.Close();<br />
//cleanup<br />
dbcmd = null;<br />
db = null;<br />
sql = null;<br />
}<br />
}<br />
}

GeneralRe: Create table in access database Pin
mav.northwind23-Mar-05 19:37
mav.northwind23-Mar-05 19:37 
GeneralMultiThread reading from stream Pin
Snowjim23-Mar-05 2:55
Snowjim23-Mar-05 2:55 
GeneralRe: MultiThread reading from stream Pin
leppie23-Mar-05 3:28
leppie23-Mar-05 3:28 
GeneralRe: MultiThread reading from stream Pin
Snowjim23-Mar-05 4:02
Snowjim23-Mar-05 4:02 
GeneralRe: MultiThread reading from stream Pin
Dave Kreskowiak23-Mar-05 11:24
mveDave Kreskowiak23-Mar-05 11:24 
GeneralStreamWriter and non-unicode writing to file Pin
23-Mar-05 1:36
suss23-Mar-05 1:36 
GeneralRe: StreamWriter and non-unicode writing to file Pin
leppie23-Mar-05 3:31
leppie23-Mar-05 3:31 
GeneralConverting to Word Pin
Amir Jalaly23-Mar-05 0:27
Amir Jalaly23-Mar-05 0:27 
GeneralRe: Converting to Word Pin
Guinness4Strength23-Mar-05 8:23
Guinness4Strength23-Mar-05 8:23 
GeneralRe: Converting to Word Pin
Amir Jalaly24-Mar-05 20:21
Amir Jalaly24-Mar-05 20:21 
GeneralRe: Converting to Word Pin
Guinness4Strength25-Mar-05 3:42
Guinness4Strength25-Mar-05 3:42 
Generalvirus over network layer Pin
computer_eng22-Mar-05 22:31
computer_eng22-Mar-05 22:31 
GeneralRe: virus over network layer Pin
leppie22-Mar-05 23:22
leppie22-Mar-05 23:22 
GeneralRe: virus over network layer Pin
Giles23-Mar-05 8:49
Giles23-Mar-05 8:49 
GeneralRe: virus over network layer Pin
leppie23-Mar-05 11:17
leppie23-Mar-05 11:17 
GeneralSecurity of code in view of disassembler Pin
Rama Sharma22-Mar-05 20:56
Rama Sharma22-Mar-05 20:56 
GeneralRe: Security of code in view of disassembler Pin
leppie22-Mar-05 22:42
leppie22-Mar-05 22:42 

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.