Click here to Skip to main content
15,916,945 members
Home / Discussions / C#
   

C#

 
QuestionHow do I open an aboutbox and close it Pin
delphidab22-Feb-06 7:01
delphidab22-Feb-06 7:01 
AnswerRe: How do I open an aboutbox and close it Pin
User 665822-Feb-06 7:10
User 665822-Feb-06 7:10 
GeneralRe: How do I open an aboutbox and close it Pin
delphidab22-Feb-06 7:24
delphidab22-Feb-06 7:24 
GeneralRe: How do I open an aboutbox and close it Pin
Dan Neely22-Feb-06 7:28
Dan Neely22-Feb-06 7:28 
GeneralRe: How do I open an aboutbox and close it Pin
delphidab22-Feb-06 7:44
delphidab22-Feb-06 7:44 
GeneralRe: How do I open an aboutbox and close it Pin
User 665822-Feb-06 7:31
User 665822-Feb-06 7:31 
GeneralRe: How do I open an aboutbox and close it Pin
delphidab22-Feb-06 7:42
delphidab22-Feb-06 7:42 
QuestionTool to generate C# code for talking to SQL? Pin
Judah Gabriel Himango22-Feb-06 6:44
sponsorJudah Gabriel Himango22-Feb-06 6:44 
I'm not usually one to complain, but I'd like to say publicly that I despise writing SQL statements using C# strings. In fact, the whole ADO.NET model really stinks, very tedious and hugely error-prone.

I mean, calling a simple stored procedure with a few arguments is a royal pain:

SqlConnection connection = new SqlConnection(...);
string commandText = "MyStoredProcName"; // I sure hope the database guy doesn't change the stored proc name, or I'll be screwed!
SqlCommand command = new SqlCommand(commandText, connection);

SqlParameter param = new SqlParameter("@param1", [database type], [data type size], [source column]...); // I sure hope the database guy doesn't change this stored proc parameter, or I'll be screwed!
param.Value = 5; // Oh, great, boxing! Thanks ADO.NET!
SqlParameter param2= new SqlParameter("@param2", ...); // ditto
param2.Value = someGuid;
command.Parameters.Add(new SqlParameter[]
{
   param1,
   param2
});

try
{
    connection.Open();
    object returnValue = command.ExecuteScalar();
    return (int)returnValue; // I sure hope the DBA doesn't modify the return type, or I'm screwed!
}
catch(SqlException)
{
    ...
}


All this for calling a single stored procedure! And refactoring -- refactoring is tedious because all the code is strings. Error prone, and no way to catch it at compile time.

So I was hoping one of you might know of some tool that either generates code like this automatically, and/or checks for the validity of code against a stored procedure. Is there anything like this?

Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Connor's Christmas Spectacular!
Judah Himango


AnswerRe: Tool to generate C# code for talking to SQL? Pin
Colin Angus Mackay22-Feb-06 11:21
Colin Angus Mackay22-Feb-06 11:21 
GeneralRe: Tool to generate C# code for talking to SQL? Pin
Judah Gabriel Himango22-Feb-06 12:27
sponsorJudah Gabriel Himango22-Feb-06 12:27 
QuestionWeb service that accesses an Access database with input from/output to a web app? Pin
Red_Wizard_Shot_The_Food22-Feb-06 6:31
Red_Wizard_Shot_The_Food22-Feb-06 6:31 
Questionadding arrows to buttons Pin
Dsypher22-Feb-06 6:30
Dsypher22-Feb-06 6:30 
AnswerRe: adding arrows to buttons Pin
Alomgir Miah22-Feb-06 7:44
Alomgir Miah22-Feb-06 7:44 
GeneralRe: adding arrows to buttons Pin
Dsypher22-Feb-06 15:24
Dsypher22-Feb-06 15:24 
Questionuninstall in remote system Pin
sendmadhavan22-Feb-06 5:35
sendmadhavan22-Feb-06 5:35 
Questiongarbage collection Pin
zhujp9822-Feb-06 5:25
zhujp9822-Feb-06 5:25 
AnswerRe: garbage collection Pin
Judah Gabriel Himango22-Feb-06 6:23
sponsorJudah Gabriel Himango22-Feb-06 6:23 
AnswerRe: garbage collection Pin
Guffa22-Feb-06 9:16
Guffa22-Feb-06 9:16 
GeneralRe: garbage collection Pin
Colin Angus Mackay22-Feb-06 11:28
Colin Angus Mackay22-Feb-06 11:28 
GeneralRe: garbage collection Pin
Guffa22-Feb-06 11:42
Guffa22-Feb-06 11:42 
GeneralRe: garbage collection Pin
Colin Angus Mackay22-Feb-06 11:50
Colin Angus Mackay22-Feb-06 11:50 
QuestionConvert String to decimal Pin
cppdotnet22-Feb-06 3:51
cppdotnet22-Feb-06 3:51 
AnswerRe: Convert String to decimal Pin
Judah Gabriel Himango22-Feb-06 4:10
sponsorJudah Gabriel Himango22-Feb-06 4:10 
GeneralRe: Convert String to decimal Pin
cppdotnet22-Feb-06 4:16
cppdotnet22-Feb-06 4:16 
GeneralRe: Convert String to decimal Pin
Judah Gabriel Himango22-Feb-06 4:29
sponsorJudah Gabriel Himango22-Feb-06 4:29 

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.