proper sql

  • Thread starter Thread starter Konrad
  • Start date Start date
K

Konrad

Hi

How should see proper sql sequence for Access.
The table name is [doc headers].

string cmd_str="INSERT INTO doc headers"+

"( Investment , Date , Doc type , Means type ) VALUES "+

"( 2 ,5 ,#2000-06-29# ,'O' ,'M')";

If first two are integer third is date and last two are letters?

Thanks

Konrad
 
Hi Konrad,

Could you please explain a little bit more about what you are doing and
what you want to achieve? Did you mean that the SQL statement does not
work? It seems that you are missing one field in the statement. The fields
and values specified in the Insert statement should match. Also, you need
to put square brackets around the field name if it contains spaces. You can
try this:

string cmd_str="INSERT INTO doc headers"+

"( Investment, <Missingcolumn> , Date , [Doc type] , [Means type] ) VALUES
"+

"( 2 ,5 ,#2000-06-29# ,'O' ,'M')";


Does this answer your question? If anything is unclear, please reply to
this post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: "Konrad" <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Subject: proper sql
| Date: Wed, 17 Sep 2003 20:14:53 +0200
| Organization: tp.internet - http://www.tpi.pl/
| Lines: 20
| Message-ID: <[email protected]>
| NNTP-Posting-Host: pj12.szczecin.sdi.tpnet.pl
| X-Trace: atlantis.news.tpi.pl 1063861610 24108 217.98.201.12 (18 Sep 2003
05:06:50 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: Thu, 18 Sep 2003 05:06:50 +0000 (UTC)
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.3790.0
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!newsfee
d01.sul.t-online.de!t-online.de!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!
news.tpi.pl!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:61473
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| Hi
|
| How should see proper sql sequence for Access.
| The table name is [doc headers].
|
| string cmd_str="INSERT INTO doc headers"+
|
| "( Investment , Date , Doc type , Means type ) VALUES "+
|
| "( 2 ,5 ,#2000-06-29# ,'O' ,'M')";
|
| If first two are integer third is date and last two are letters?
|
| Thanks
|
| Konrad
|
|
|
|
|
 
string cmd_str = "INSERT INTO [doc headers] (Investment, [Date], [Doc type],
[Means type] Values ?, ?, ?, ?");

cmd.Parameters.Clear();
cmd.Parameters.Add(2)
cmd.Parameters.Add[#2000-o6-29#];

etc

Also, those column names are going to give you grief......Change Date to a
non-reserved key word and get those spaces out of the rest of them. Sure,
you can work around it, but it's an unnecessary pain.

HTH,

Bill
 
Back
Top