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

C#

 
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 
GeneralRe: Create table in access database Pin
mav.northwind23-Mar-05 19:37
mav.northwind23-Mar-05 19:37 
Ouch!
Why on earth are you using a StringWriter to build your SQL query?
Could it be that you thought of the StringBuilder class? But even then, your create table statement can be packed in a single string and thus be much more readable.

And the OleDbCommand can be created with one line, not 5 like in your code: OleDbCommand dbcmd = new OleDbCommand(db, commandText);

You shouldn't set your objects to null at the end of your function, but rather call their Dispose() methods so that resources are freed before the objects are garbage collected. This should be done even in an error situation, so using a try/finally would be a good idea.

If you get an error, knowing what the error is is essential to fixing it. I guess you're getting an OleDbException telling you that there's a syntax error somewhere. I don't remember all the data types for Access, but I think the line id int identity(1, 1) isn't syntactically correct. IIRC, you'll have to use counter instead of int identity(1,1).

Regards,
mav
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 
Questionhow to check password and user name Pin
Aleyna22-Mar-05 20:38
Aleyna22-Mar-05 20:38 

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.