Click here to Skip to main content
12,360,419 members (55,225 online)
   

C#

 
GeneralRe: How can i disable temporarily warnings/error from the code? Pin
e-laj11-Feb-06 11:59
membere-laj11-Feb-06 11:59 
Questionenumeration was modified operation may not execute Pin
spirit_of_pak11-Feb-06 6:23
memberspirit_of_pak11-Feb-06 6:23 
AnswerRe: enumeration was modified operation may not execute Pin
Ravi Bhavnani11-Feb-06 6:38
memberRavi Bhavnani11-Feb-06 6:38 
AnswerRe: enumeration was modified operation may not execute Pin
perlmunger11-Feb-06 6:45
memberperlmunger11-Feb-06 6:45 
GeneralRe: enumeration was modified operation may not execute Pin
Dave Kreskowiak11-Feb-06 8:46
memberDave Kreskowiak11-Feb-06 8:46 
GeneralRe: enumeration was modified operation may not execute Pin
perlmunger11-Feb-06 11:10
memberperlmunger11-Feb-06 11:10 
AnswerRe: enumeration was modified operation may not execute Pin
malharone11-Feb-06 7:31
membermalharone11-Feb-06 7:31 
GeneralRe: enumeration was modified operation may not execute Pin
Colin Angus Mackay11-Feb-06 13:41
memberColin Angus Mackay11-Feb-06 13:41 
GeneralRe: enumeration was modified operation may not execute Pin
malharone11-Feb-06 18:14
membermalharone11-Feb-06 18:14 
GeneralRe: enumeration was modified operation may not execute Pin
Colin Angus Mackay12-Feb-06 1:34
memberColin Angus Mackay12-Feb-06 1:34 
GeneralRe: enumeration was modified operation may not execute Pin
malharone12-Feb-06 5:27
membermalharone12-Feb-06 5:27 
GeneralRe: enumeration was modified operation may not execute Pin
spirit_of_pak12-Feb-06 17:28
memberspirit_of_pak12-Feb-06 17:28 
QuestionError Pin
NaNg1524111-Feb-06 3:54
memberNaNg1524111-Feb-06 3:54 
AnswerRe: Error Pin
perlmunger11-Feb-06 7:15
memberperlmunger11-Feb-06 7:15 
You either need to set the insert command's command text or you need to use parameters. Change your code to do this instead:
string selectCommand = "SELECT COUNT..."; // ... for brevity
objDA = new OleDbDataAdapter( selectCommand, connection );
objDA.InsertCommand.CommandText = string.Format("Insert into tblProjects(SProjID, SProjName) Values('{0}', '{1}')", ProjID, ProjName);
objDA.InsertCommand.ExecuteNonQuery();
Alternatively, you can use parameters like this:
string selectCommand = "SELECT COUNT..."; // ... for brevity
objDA = new OleDbDataAdapter( selectCommand, connection );
objDA.InsertCommand = new OleDbCommand( "Insert into tblProjects(SProjID, SProjName) Values( ?, ?)", connection );
objDA.InsertCommand.Parameters.Add( "@SProjID", OleDbType.VarChar, 30, "SProjID" ).Value = ProjID;
objDA.InsertCommand.Parameters.Add( "@SProjName", OleDbType.VarChar, 30, "SProjName" ).Value = ProjName;
objDA.InsertCommand.ExecuteNonQuery();
Hope that helps.

-Matt

------------------------------------------

The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
GeneralRe: Error Pin
NaNg1524111-Feb-06 8:13
memberNaNg1524111-Feb-06 8:13 
GeneralRe: Error Pin
NaNg1524111-Feb-06 9:36
memberNaNg1524111-Feb-06 9:36 
GeneralRe: Error Pin
perlmunger11-Feb-06 11:09
memberperlmunger11-Feb-06 11:09 
QuestionCreate list with Grid and getting Process info in C#. Pin
yanshof11-Feb-06 1:37
memberyanshof11-Feb-06 1:37 
AnswerSome one can help me with this question please ? Pin
yanshof11-Feb-06 9:02
memberyanshof11-Feb-06 9:02 
AnswerRe: Create list with Grid and getting Process info in C#. Pin
Dave Kreskowiak11-Feb-06 10:51
memberDave Kreskowiak11-Feb-06 10:51 
QuestionHow to browse SQL server from a network? Pin
bouli10-Feb-06 21:46
memberbouli10-Feb-06 21:46 
AnswerRe: How to browse SQL server from a network? Pin
perlmunger11-Feb-06 6:34
memberperlmunger11-Feb-06 6:34 
QuestionI need Help Pin
BestArtemis10-Feb-06 21:22
memberBestArtemis10-Feb-06 21:22 
AnswerRe: I need Help Pin
Wayne Phipps10-Feb-06 21:35
memberWayne Phipps10-Feb-06 21:35 
QuestionDLL Problem Pin
ExpertComing10-Feb-06 14:06
memberExpertComing10-Feb-06 14:06 
AnswerRe: DLL Problem Pin
Dave Kreskowiak10-Feb-06 14:28
memberDave Kreskowiak10-Feb-06 14:28 
GeneralRe: DLL Problem (How?) Pin
ExpertComing10-Feb-06 14:33
memberExpertComing10-Feb-06 14:33 
GeneralRe: DLL Problem (How?) Pin
Dave Kreskowiak10-Feb-06 14:56
memberDave Kreskowiak10-Feb-06 14:56 
GeneralRe: DLL Problem (How?) Pin
kourvoisier10-Feb-06 14:59
memberkourvoisier10-Feb-06 14:59 
GeneralRe: DLL Problem (How?) Pin
ExpertComing10-Feb-06 15:09
memberExpertComing10-Feb-06 15:09 
GeneralRe: DLL Problem (How?) Pin
Dave Kreskowiak10-Feb-06 16:50
memberDave Kreskowiak10-Feb-06 16:50 
GeneralRe: DLL Problem (How?) Pin
ExpertComing10-Feb-06 17:09
memberExpertComing10-Feb-06 17:09 
GeneralRe: DLL Problem (How?) Pin
Dave Kreskowiak10-Feb-06 17:25
memberDave Kreskowiak10-Feb-06 17:25 
GeneralRe: DLL Problem (How?) Pin
ExpertComing10-Feb-06 17:32
memberExpertComing10-Feb-06 17:32 
Question2 question about C#.... Pin
yanshof10-Feb-06 12:37
memberyanshof10-Feb-06 12:37 
AnswerRe: 2 question about C#.... Pin
ExpertComing10-Feb-06 13:03
memberExpertComing10-Feb-06 13:03 
AnswerRe: 2 question about C#.... Pin
Sean8910-Feb-06 13:16
memberSean8910-Feb-06 13:16 
AnswerRe: 2 question about C#.... Pin
perlmunger10-Feb-06 18:14
memberperlmunger10-Feb-06 18:14 
QuestionDrawing with c# Pin
kourvoisier10-Feb-06 12:29
memberkourvoisier10-Feb-06 12:29 
AnswerRe: Drawing with c# Pin
VectorX10-Feb-06 12:37
memberVectorX10-Feb-06 12:37 
GeneralRe: Drawing with c# Pin
TheJudeDude10-Feb-06 13:47
memberTheJudeDude10-Feb-06 13:47 
GeneralRe: Drawing with c# Pin
kourvoisier10-Feb-06 14:54
memberkourvoisier10-Feb-06 14:54 
GeneralRe: Drawing with c# Pin
TheJudeDude10-Feb-06 14:57
memberTheJudeDude10-Feb-06 14:57 
QuestionWindows Service Interaction Pin
perlmunger10-Feb-06 10:45
memberperlmunger10-Feb-06 10:45 
AnswerRe: Windows Service Interaction Pin
Ravi Bhavnani10-Feb-06 11:14
memberRavi Bhavnani10-Feb-06 11:14 
GeneralRe: Windows Service Interaction Pin
perlmunger10-Feb-06 11:30
memberperlmunger10-Feb-06 11:30 
AnswerRe: Windows Service Interaction Pin
Nicholas Butler11-Feb-06 0:28
memberNicholas Butler11-Feb-06 0:28 
QuestionWhat is 192.168.1.1 Pin
jinzhecheng10-Feb-06 10:18
memberjinzhecheng10-Feb-06 10:18 
AnswerRe: What is 192.168.1.1 Pin
Vlad Stanciu10-Feb-06 10:24
memberVlad Stanciu10-Feb-06 10:24 
GeneralRe: What is 192.168.1.1 Pin
perlmunger10-Feb-06 10:35
memberperlmunger10-Feb-06 10:35 

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.


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 1 Jul 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid