Click here to Skip to main content
15,888,162 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerREPOST Pin
Afzaal Ahmad Zeeshan18-May-15 3:46
professionalAfzaal Ahmad Zeeshan18-May-15 3:46 
QuestionHow to get source files from GoDaddy to local machine Pin
indian14316-May-15 8:41
indian14316-May-15 8:41 
AnswerRe: How to get source files from GoDaddy to local machine Pin
F-ES Sitecore16-May-15 10:05
professionalF-ES Sitecore16-May-15 10:05 
GeneralRe: How to get source files from GoDaddy to local machine Pin
indian14316-May-15 18:56
indian14316-May-15 18:56 
QuestionMessage Closed Pin
15-May-15 4:15
Mohammad Sadegh Zohari15-May-15 4:15 
QuestionHelp with a static class Pin
Stephen Holdorf15-May-15 2:10
Stephen Holdorf15-May-15 2:10 
QuestionRe: Help with a static class Pin
Richard MacCutchan15-May-15 3:02
mveRichard MacCutchan15-May-15 3:02 
SuggestionRe: Help with a static class Pin
Richard Deeming15-May-15 3:56
mveRichard Deeming15-May-15 3:56 
As Sascha told you two days ago[^], that class does not resolve your SQL Injection[^] vulnerabilities.

Rather than wasting time trying to fix this class, concentrate on fixing the calling code. You can either do that by writing raw ADO.NET code using properly parameterized queries; or you can use something like Dapper[^]; or switch to one of the many available .NET ORM solutions.

Correct ADO.NET code would look something like this:
C#
public int GetAccountSortByAccountCode(int account)
{
    using (var connection = new SqlConnection("YOUR CONNECTION STRING"))
    using (var command = new SqlCommand("SELECT ac_sort_order FROM lkup_account_codes where ac_code = @account", connection))
    {
        command.Parameters.AddWithValue("@account", account);

        connection.Open();
        return Convert.ToInt32(command.ExecuteScalar());
    }
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Help with a static class Pin
Stephen Holdorf15-May-15 4:09
Stephen Holdorf15-May-15 4:09 
GeneralRe: Help with a static class Pin
Richard Deeming15-May-15 4:11
mveRichard Deeming15-May-15 4:11 
GeneralRe: Help with a static class Pin
Stephen Holdorf15-May-15 6:52
Stephen Holdorf15-May-15 6:52 
GeneralRe: Help with a static class Pin
Richard Deeming15-May-15 7:04
mveRichard Deeming15-May-15 7:04 
GeneralRe: Help with a static class Pin
Sascha Lefèvre15-May-15 8:23
professionalSascha Lefèvre15-May-15 8:23 
GeneralRe: Help with a static class Pin
Stephen Holdorf18-May-15 1:47
Stephen Holdorf18-May-15 1:47 
GeneralRe: Help with a static class [modified] Pin
Sascha Lefèvre18-May-15 2:07
professionalSascha Lefèvre18-May-15 2:07 
GeneralRe: Help with a static class Pin
Sascha Lefèvre18-May-15 2:10
professionalSascha Lefèvre18-May-15 2:10 
GeneralRe: Help with a static class Pin
Richard Deeming18-May-15 2:36
mveRichard Deeming18-May-15 2:36 
GeneralRe: Help with a static class Pin
Stephen Holdorf18-May-15 3:48
Stephen Holdorf18-May-15 3:48 
GeneralRe: Help with a static class Pin
Richard Deeming18-May-15 3:50
mveRichard Deeming18-May-15 3:50 
GeneralRe: Help with a static class Pin
jkirkerx18-May-15 12:19
professionaljkirkerx18-May-15 12:19 
GeneralRe: Help with a static class Pin
Stephen Holdorf20-May-15 3:02
Stephen Holdorf20-May-15 3:02 
GeneralRe: Help with a static class Pin
Sascha Lefèvre20-May-15 4:22
professionalSascha Lefèvre20-May-15 4:22 
GeneralRe: Help with a static class Pin
Stephen Holdorf20-May-15 4:28
Stephen Holdorf20-May-15 4:28 
GeneralRe: Help with a static class Pin
Sascha Lefèvre20-May-15 4:34
professionalSascha Lefèvre20-May-15 4:34 
GeneralRe: Help with a static class Pin
Stephen Holdorf20-May-15 4:40
Stephen Holdorf20-May-15 4:40 

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.