Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP logical -> MSSql Bit
Message
From
05/01/2009 16:06:32
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01371150
Message ID:
01371204
Views:
18
>>>Ok, I give up. How do I send a logical VFP value to a MSSql 2005 bit field.
>>>
>>>.T. and .F. don't work, 1 and 0 don't work, and even though SQL Server says it will take the string values of 'True' and 'False' (and it will in Management Studio), they don't work from VFP either.
>>>
>>>Any help is appreciated.
>>
>>
>>
MyLogical1 = .t.
>>MyLogical2 = .t.
>>
>>SQLExec(m.handle, "update mySQLTable set bitField1 = ?m.MyLogical1, bitField2 = ?m.myLogical2")
Cetin
>
>Not SPT :-)
>ADODB recordset.
>Happy new year!

Thanks for the information and happy new year too:) I didn't see it but it wouldn't matter. .f./.t. would be recognized as well as 1/0 (CCed to Alan).
Local loRS As ADODB.Recordset, ;
  loCon As ADODB.Connection, ;
  loCmd As ADODB.Command

loCon = Createobject("ADODB.Connection")
loCmd = Createobject('ADODB.Command')
loRS  = Createobject("ADODB.RecordSet")
With loCon
  .ConnectionString = "provider=sqlncli;server=.\sqlexpress;"+;
  "trusted_connection=yes;database=northwind"
  .Open()
Endwith
With loCmd
  .ActiveConnection = loCon
  .CommandType = 2	&& Table
  .CommandText = 'products'
Endwith
With loRS
  .CursorType 	= 2		&& ADOPENDYNAMIC
  .LockType 	= 4		&& ADLOCKBATCHOPTIMISTIC
  .CursorLocation = 3		&& ADUSECLIENT
  .ActiveConnection = loCon
  .Open(loCmd)
Endwith

loRS.AddNew()
loRS.Fields("productName").Value = "Added new"
loRS.Fields("discontinued").Value = .t.
loRS.AddNew()
loRS.Fields("productName").Value = "Added new 2"
loRS.Fields("discontinued").Value = .f.

loRS.UpdateBatch()
loRS.Close()
loCon.Close()
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform