|
-
September 20th, 2001, 06:16 AM
#1
adding CStrings to a database
How do I add CStrings to fields in a record using ado. What should the field type in the database file be for this?
Mike B
-
September 20th, 2001, 07:14 AM
#2
Re: adding CStrings to a database
varchar(n) where n is a max string length
Bayram.
-
September 20th, 2001, 07:26 AM
#3
Re: adding CStrings to a database
_RecordsetPtr pRs;
[...Recorset init...]
//FieldName is your varchar/nvarchar field
CString FieldName = "MyField";
CString toAdd = "toto";
//add "toto" to "MyField" Field
pRs->GetFields()->GetItem(vChpName)->PutValue(_variant_t(toAdd));
//... other fields
pRs->Update();
verify that your recordset allow update
nb: variant initialisation for int:
_variant_t vi;
vi.vt = VT_I4; //or VT_I2
vi.iVal = 2;
hope it help
...addicted to cpp...
-
November 23rd, 2001, 11:58 PM
#4
Re: adding CStrings to a database
I have the same problem. How if I wanna add to database with CString type more than 255 characters? It runs with fewer characters. I use SQL Server 7.0 as a backend DB engine.
How much char is the max???
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|