Adding records to SQL Server 
Author Message
 Adding records to SQL Server

I am newbie with this Visual C++ -SQL Server stuff.

I have rowset and Ican fetch data like this

int m_ID = 0;
int m_Value = 0;

CMyRowset MySet;
MySet.Open();
m_ID = MySet.m_ID;
m_Value = MySet.m_Value;
MySet.Close();

What should I do if I want to insert new record or if
I want to change records?
I found methods Update and Insert but I don't know how
to use them.



Sun, 27 Jul 2003 21:49:38 GMT  
 Adding records to SQL Server

Quote:

>I am newbie with this Visual C++ -SQL Server stuff.

>I have rowset and Ican fetch data like this

>int m_ID = 0;
>int m_Value = 0;

>CMyRowset MySet;
>MySet.Open();
>m_ID = MySet.m_ID;
>m_Value = MySet.m_Value;
>MySet.Close();

>What should I do if I want to insert new record or if
>I want to change records?
>I found methods Update and Insert but I don't know how
>to use them.

In a Recordset (I guess Rowset is similar), you call Edit(), then set
the member variables, then call Update(). This edits a record. To add
a new record, call AddNew() instead of Edit().

HTH

Paul.
-------------------------------------------
Expressed opinions are usually my own.
Especially if they're any good (of course).
-------------------------------------------



Sun, 27 Jul 2003 22:46:07 GMT  
 Adding records to SQL Server
Quote:
> In a Recordset (I guess Rowset is similar), you call Edit(), then set
> the member variables, then call Update(). This edits a record. To add
> a new record, call AddNew() instead of Edit().

:)) I worked before with DAO and recordsets and I tried similar
thing here, but it simlpy doesn't work.
I tried call delete method, and everything is OK but nothing
happens in database.
Does anybody knows should I set some special property or
anything?


Sun, 27 Jul 2003 23:45:39 GMT  
 Adding records to SQL Server
In fact, delete is working OK, but I can manage to update and
insert record!


Mon, 28 Jul 2003 00:23:56 GMT  
 Adding records to SQL Server
What software are you using(development) and what service pack for SQL
Server are you running?

Their is a problem with SQL Server out of the box Recordset.Update()
command. You have to install atleast SP1 for SQL Server to fix this problem.

Good luck,

JD

Quote:
> > In a Recordset (I guess Rowset is similar), you call Edit(), then set
> > the member variables, then call Update(). This edits a record. To add
> > a new record, call AddNew() instead of Edit().

> :)) I worked before with DAO and recordsets and I tried similar
> thing here, but it simlpy doesn't work.
> I tried call delete method, and everything is OK but nothing
> happens in database.
> Does anybody knows should I set some special property or
> anything?



Tue, 12 Aug 2003 21:25:20 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. CRecordset: Error when adding records SQL Server view

2. Need ID of a record added to SQL-Server using MFC/ODBC/CRecordset

3. Getting a random record from a SQL Server table

4. Locking a record in an MS-SQL Server

5. Error updating SQL-Server record via ODBC (CRecordset)

6. Problem Fetching Records in Bulk using MFC/ODBC/SQL Server

7. Cannot delete SQL server duplicate records

8. Records being locked in SQL Server database

9. ADO record binding from SQL server to String type

10. Update call to SQL Server with large record never returns

11. Deleting records in SQL server from VC++ DAO connection

12. Inserting Muliple Records into SQL-SERVER Database

 

 
Powered by phpBB® Forum Software