Click here to Skip to main content
15,908,111 members
Home / Discussions / C#
   

C#

 
GeneralRe: about get connection string from app.config Pin
therealmccoy28-Sep-05 16:10
therealmccoy28-Sep-05 16:10 
QuestionVisual C# Express Pin
kenexcelon27-Sep-05 16:40
kenexcelon27-Sep-05 16:40 
Questionrenaming nodes Pin
xilefxilef27-Sep-05 16:07
xilefxilef27-Sep-05 16:07 
QuestionI want to draw a empty triangular arrow Pin
dreamwinter27-Sep-05 15:03
dreamwinter27-Sep-05 15:03 
JokeRe: I want to draw a empty triangular arrow Pin
Christian Graus27-Sep-05 15:39
protectorChristian Graus27-Sep-05 15:39 
GeneralRe: I want to draw a empty triangular arrow Pin
dreamwinter27-Sep-05 22:04
dreamwinter27-Sep-05 22:04 
GeneralRe: I want to draw a empty triangular arrow Pin
Christian Graus28-Sep-05 1:09
protectorChristian Graus28-Sep-05 1:09 
QuestionCrazy question about reflection Pin
Colin Angus Mackay27-Sep-05 11:52
Colin Angus Mackay27-Sep-05 11:52 
Okay, I think this is going to sound like a crazy question and I think I already know the answer, but I thought I'd throw it out there just to see if I've missed something.

I have a DAO/DAL (Data Access Object/Data Access Layer) class that communicates with SQL Server. The methods have a number of parameters which map to the parameters being sent into the stored procedure. Because I use a cradle-to-grave naming convention the name of the SQL Parameters are exactly the same as the parameters passed into the method.

Is there any way to iterate over the values being passed into the method and create the appropriate SqlParameter objects? I want to do something like this:

SqlCommand cmd = new SqlCommand("myStoredProcedure");
foreach(ParameterInfo paramInfo in methodParameters)
{
    string name = paramInfo.Name;
    object value = somethingIDontKnowWhat[name].Value;
    cmd.Parameters.Add("@"+name, value);
}


I did think of passing in a Hashtable and iterating over that, but I want the security of the compiler throwing out errors if there are parameters missing.

Any other ideas?


My: Blog | Photos

"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious


AnswerRe: Crazy question about reflection Pin
Guffa28-Sep-05 0:28
Guffa28-Sep-05 0:28 
GeneralRe: Crazy question about reflection Pin
Colin Angus Mackay28-Sep-05 2:27
Colin Angus Mackay28-Sep-05 2:27 
GeneralRe: Crazy question about reflection Pin
Guffa28-Sep-05 9:25
Guffa28-Sep-05 9:25 
GeneralRe: Crazy question about reflection Pin
Colin Angus Mackay28-Sep-05 12:36
Colin Angus Mackay28-Sep-05 12:36 
GeneralRe: Crazy question about reflection Pin
Guffa29-Sep-05 1:06
Guffa29-Sep-05 1:06 
QuestionBroadcast a Windows Message (C#) Pin
emarborg27-Sep-05 11:27
emarborg27-Sep-05 11:27 
AnswerRe: Broadcast a Windows Message (C#) Pin
Dave Kreskowiak27-Sep-05 12:30
mveDave Kreskowiak27-Sep-05 12:30 
QuestionDataGridView.ColumnHeadersDefaultCellStyle Pin
Drew McGhie27-Sep-05 10:10
Drew McGhie27-Sep-05 10:10 
QuestionWierd serialization behaviour Pin
jolofsson27-Sep-05 9:43
jolofsson27-Sep-05 9:43 
AnswerRe: Wierd serialization behaviour Pin
turbochimp28-Sep-05 2:08
turbochimp28-Sep-05 2:08 
QuestionEdit .msi database programatically Pin
Asad Hussain27-Sep-05 9:07
Asad Hussain27-Sep-05 9:07 
AnswerRe: Edit .msi database programatically Pin
Christian Graus27-Sep-05 9:25
protectorChristian Graus27-Sep-05 9:25 
AnswerRe: Edit .msi database programatically Pin
Dave Kreskowiak27-Sep-05 12:28
mveDave Kreskowiak27-Sep-05 12:28 
AnswerRe: Edit .msi database programatically Pin
Sean Michael Murphy28-Sep-05 8:35
Sean Michael Murphy28-Sep-05 8:35 
QuestionAccess XML element directly Pin
Seraphin27-Sep-05 6:31
Seraphin27-Sep-05 6:31 
AnswerRe: Access XML element directly Pin
Gavin Jeffrey27-Sep-05 8:22
Gavin Jeffrey27-Sep-05 8:22 
QuestionListView in details view with values... Pin
Niklas Ulvinge27-Sep-05 6:11
Niklas Ulvinge27-Sep-05 6:11 

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.