Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 To: Chris
  Where is Chris?
 
 North Carolina - United States
 Chris
 Tags
Subject: RE: SQL command examples
Thread ID: 155208 Message ID: 155263 # Views: 1 # Ratings: 0
Version: Visual FoxPro 8 Category: .NET
Date: Friday, December 28, 2007 4:19:09 PM         
   


> >
> > Chris,
> > Why don't you simply use parameters and use corresponding .Net datatypes (DateTime for date/datetime, bool for logical ...).
> >
> > PS:
> >
> > mycommand = "insert into c:\btn(btn, current) values ('3368675309', " & True & ")"
> >
> > should yiled a string like
> >
> >
insert into c:\btn(btn, current) values ('3368675309', True )

> >
> > and VFP doesn't know what True is.
> >
> > Check https://www.foxite.com/archives/vfpole-dates-0000153532.htm
> >
> > Cetin Basoz
>
> I guess I'd have to respond to that with why would I want to use parameters. It takes a lot more code writing than just setting the commandtext to the new insert string. And in my way of looking at it this example is using parameters mycommand = "insert into c:\btn(btn) values ('" & phonebox.text & "')"
>
> I'll take a look at the date format.

Why would you? One simple reason you wouldn't think how to create correct string if you do it all with string. Other might be about SQL injection. Well do not use if you don't want to and could do it all w/o parameters:)
string insertCommand = _
 String.Format( "insert into c:\btn (myDate) values ({0})", DateTime.Now.ToString("{^yyyy/MM/dd}") );

Cetin Basoz

ENTIRE THREAD

SQL command examples Posted by Chris @ 12/27/2007 8:38:59 PM
RE: SQL command examples Posted by Cetin Basoz @ 12/27/2007 10:57:48 PM
RE: SQL command examples Posted by Chris @ 12/28/2007 2:55:53 PM
RE: SQL command examples Posted by Cetin Basoz @ 12/28/2007 4:19:09 PM