Click here to Skip to main content
15,914,608 members
Home / Discussions / C#
   

C#

 
GeneralCould someone please post a tutorial Pin
MeterMan20-Apr-04 8:54
MeterMan20-Apr-04 8:54 
GeneralRe: Could someone please post a tutorial Pin
Heath Stewart20-Apr-04 9:09
protectorHeath Stewart20-Apr-04 9:09 
GeneralRe: Could someone please post a tutorial Pin
MeterMan20-Apr-04 15:34
MeterMan20-Apr-04 15:34 
GeneralRe: Could someone please post a tutorial Pin
Heath Stewart21-Apr-04 3:01
protectorHeath Stewart21-Apr-04 3:01 
GeneralRe: Could someone please post a tutorial Pin
MeterMan20-Apr-04 23:21
MeterMan20-Apr-04 23:21 
GeneralRe: Could someone please post a tutorial Pin
Heath Stewart21-Apr-04 3:12
protectorHeath Stewart21-Apr-04 3:12 
GeneralOleDbDataAdapter Pin
Mehdi Mousavi20-Apr-04 8:49
Mehdi Mousavi20-Apr-04 8:49 
GeneralRe: OleDbDataAdapter Pin
Heath Stewart20-Apr-04 9:06
protectorHeath Stewart20-Apr-04 9:06 
First, don't use the OleDbDataAdapter for SQL Server! Use the SQL Server-specific classes in the System.Data.SqlClient namespace. They exhibit much more functionality and provide features that the generic OLE DB providers can't provide (at least in an abstract manner).

Second, use a typed DataSet, or construct one programmatically at runtime (not fun). You can create an identity column in one of your tables. When you insert a row into that DataTable, the column value is incremented to the next identity using your incremental step. This allows your FK column to reference the identity PK. This is easy to do.

The trick in a multi-user database-driven application is when you use that DataSet to update the database using SqlDataAdapter.Update. You should read the article, Inserting relational data using DataSet and DataAdapter[^]. Basically, your InsertCommand should also include a SELECT statement to make sure the DataSet is updated appropriately. The relationship that would exist in the DataSet for the PK/FK would update the FK with the PK value that was actually used when the row was inserted.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: OleDbDataAdapter Pin
Mehdi Mousavi20-Apr-04 9:55
Mehdi Mousavi20-Apr-04 9:55 
GeneralRe: OleDbDataAdapter Pin
Heath Stewart20-Apr-04 10:07
protectorHeath Stewart20-Apr-04 10:07 
Questionhow can communicate with a router Pin
kashif anwar syed20-Apr-04 8:33
kashif anwar syed20-Apr-04 8:33 
AnswerRe: how can communicate with a router Pin
Heath Stewart20-Apr-04 8:51
protectorHeath Stewart20-Apr-04 8:51 
AnswerRe: how can communicate with a router Pin
Klaus Weisser20-Apr-04 9:17
Klaus Weisser20-Apr-04 9:17 
GeneralRe: how can communicate with a router Pin
Anonymous23-Apr-04 17:43
Anonymous23-Apr-04 17:43 
GeneralEmbed C# controls in MFC views/dialogs Pin
rkvs20-Apr-04 7:51
rkvs20-Apr-04 7:51 
GeneralRe: Embed C# controls in MFC views/dialogs Pin
Heath Stewart20-Apr-04 8:48
protectorHeath Stewart20-Apr-04 8:48 
Generalserial communication in c# Pin
balsmn20-Apr-04 7:34
balsmn20-Apr-04 7:34 
GeneralRe: serial communication in c# Pin
Heath Stewart20-Apr-04 8:37
protectorHeath Stewart20-Apr-04 8:37 
GeneralRe: serial communication in c# Pin
Marc Clifton20-Apr-04 13:37
mvaMarc Clifton20-Apr-04 13:37 
GeneralSmall string building question Pin
Le centriste20-Apr-04 6:26
Le centriste20-Apr-04 6:26 
GeneralRe: Small string building question Pin
Jeremy Kimball20-Apr-04 6:37
Jeremy Kimball20-Apr-04 6:37 
GeneralRe: Small string building question Pin
Mike Dimmick20-Apr-04 6:45
Mike Dimmick20-Apr-04 6:45 
GeneralRe: Small string building question Pin
Heath Stewart20-Apr-04 8:33
protectorHeath Stewart20-Apr-04 8:33 
GeneralRe: Small string building question Pin
Jeff Varszegi20-Apr-04 9:33
professionalJeff Varszegi20-Apr-04 9:33 
GeneralRe: Small string building question Pin
Mike Dimmick20-Apr-04 6:42
Mike Dimmick20-Apr-04 6:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.