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


> > I could use a couple of sample sql insert commands so I'd know how to fill foxpro fields of varying types using sql from .net.
> >
> > To fill the foxpro character type field btn in the database c:\btn
> > mycommand = "insert into c:\btn(btn) values ('3368675309')"
> >
> > Ok, now suppose I also want to fill a date field last_call -- what do I do?
> > mycommand = "insert into c:\btn(btn, last_call) values ('3368675309', ??????)"
> >
> > What about a logical field say current.
> > These 2 work
> > mycommand = "insert into c:\btn(btn, current) values ('3368675309', 1)"
> > mycommand = "insert into c:\btn(btn, current) values ('3368675309', .T.)"
> > I wonder why this doesn't
> > mycommand = "insert into c:\btn(btn, current) values ('3368675309', " & True & ")"
>
> 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.

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