Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

Greg Chelstowski

@Greg Chelstowski
About
Posts
135
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • record no update
    G Greg Chelstowski

    The values you try to add to your ugly dynamic SQL are of type DataGridViewCell So first of all, use dataGridView1.CurrentRow.Cells[x].Value to extract the values and as OriginalGriff already said, use parameterized queries. It's easier, more readable, more efficient and NOT UGLY.

    var question = (_2b || !(_2b));

    C# help announcement

  • Notify users
    G Greg Chelstowski

    MorgSim wrote:

    Thanks man, you have made sound so simple. I will try that

    "It's all relative". ;) Seriously, good luck. I'm sure you'll get there.

    var question = (_2b || !(_2b));

    C# help database question

  • Notify users
    G Greg Chelstowski

    OK. First of all, look up parameterized queries, if you can't use stored procedures. Second, I fail to realize what your problem is. Your while loop adds items to your collection, why not check the length of the collection after the while loop has run? If it's 0 - obviously no records were returned. And third: close your connection. Maybe add a finally statement to your try-catch? :)

    var question = (_2b || !(_2b));

    C# help database question

  • creating Dynmaic Objects in C#
    G Greg Chelstowski

    OriginalGriff wrote:

    DriveInfoClassFromMicroSoftTOMakeYourLifeHarder, in case you were wondering...

    ROFL! I was wondering, I knew there had to be some method to that madness ;)

    var question = (_2b || !(_2b));

    C# tutorial csharp help

  • NetMeeting using C#
    G Greg Chelstowski

    oh, oh, oh!! How exciting, yipeee! We are so happy you shared and want to include us all in your project! Let us all research everything for you, compose relevant documentation and then code it, showing you every step of the way how and why stuff works like it does! Can we, please?

    var question = (_2b || !(_2b));

    C# csharp tutorial question

  • datatable filter
    G Greg Chelstowski

    abcurl wrote:

    I have to check it at runtime

    ???

    abcurl wrote:

    and there is no static value as written by you in query

    Then use variables. And by static I'm sure you meant hard-coded.

    abcurl wrote:

    the datatable can have any number of both numeric, alphanumeric records.

    Use single quotes in the query then! Now, once you actually got your DataRow array, I'm sure you'll be asking next how to extract values from it. Look, do some reading on MSDN, there are a million tutorials and examples on the .Select method of DataTable.

    var question = (_2b || !(_2b));

    C# question

  • datatable filter
    G Greg Chelstowski

    The Select method of the DataTable class allows you to do just that, using pseudo T-SQL. It returns an array of DataRow. E.g.:

    DataRow[] results = yourDataTable.Select("aa=15");

    var question = (_2b || !(_2b));

    C# question

  • datatable...
    G Greg Chelstowski

    "Technically", the bug is here (your assigning a whole new datatable as your Session["cart"] object).

    mylogics wrote:

    dt.Rows.Add(row); Session["cart"] = dt;

    If your Session["cart"] schema is the same as dt just do:

    ((DataTable)Session["cart"]).Rows.Add(row);

    But the whole thing is veerrry messsssyy.... Come on man, ever heard of Sql injection? I see you use parameters in your Update method, good - use them all round your code, better yet, turn those sql strings into stored procedures.

    var question = (_2b || !(_2b));

    ASP.NET tutorial csharp help

  • i need help
    G Greg Chelstowski

    Yeah, great answer. I'd mark it as "bestest ever" but the developers of this site probably never knew you'd come along...

    Blikkies wrote:

    You can use ADO.net or data set to get you data from DB.

    What the hell does that bring to anything? It's like somebody asked: "I'm having trouble fitting windows in my house, I know where I want them and I have a fitting kit for them" and you answered "You can use a hammer or its handle to bang nails into a wall." As for the author of the question, you'd be better off reading a book on C# and/or a tutorial online. Rome was not built in a day.

    var question = (_2b || !(_2b));

    C# database help question

  • barcode
    G Greg Chelstowski

    From what I know about barcodes, they are graphical representations of a string of bits, where one digit is a 7 bit string (from EAN-13 specs). Now, I am also sure, that any barcode reader would read that number from a barcode, otherwise it's totally useless. Whether it can connect with your database and pick up other information about it-- well how in the world are we supposed to know that? Now, I fail to realize your problem, i.e. :

    mylogics wrote:

    accordingly perform the task...

    What "task" are you talking about? Bringing up the price on you barcode reader? Description? What?

    var question = (_2b || !(_2b));

    ASP.NET tutorial announcement

  • how can u insert values in the database
    G Greg Chelstowski

    I see the thread switched locations, but still blossoms... Let's wait till it moves again, because I think all the information provided to that guy is totally irrelevant to him.

    var question = (_2b || !(_2b));

    ASP.NET csharp help asp-net database sysadmin

  • not able to insert the values
    G Greg Chelstowski

    Should I use my invisibility to fight crime or for evil. Look at the first reply, Captain Obvious. And my next one. And at the end of his insertSQL+= crap, see that there's an unnecessary comma being sent along with the rest of the T-SQL. Ok, that's it.

    var question = (_2b || !(_2b));

    ASP.NET csharp help asp-net sysadmin security

  • not able to insert the values
    G Greg Chelstowski

    For crying out loud man, your t-sql is totally out of whack. There might not be any syntax error in your C# project, all it sees is building a string for the most part. What is the exception caught? Did you debug it? I bet the farm though, your insert statement has been built incorrectly, because one can plainly see that looking at it. As i said, close the damn bracket and get rid of the comma, would you? Oh yeah, sorry. I hadnt noticed you're not even CATCHING the exception. Well, good luck--

    var question = (_2b || !(_2b));

    ASP.NET csharp help asp-net sysadmin security

  • not able to insert the values
    G Greg Chelstowski

    Even though this is madness, i think it's going to work when you close the bracket here: insertSQL += "workplace, job, skills"; insertSQL+=") "; insertSQL += "VALUES ('"; and get rid of the comma here: insertSQL += TextBox20.Text; What I really want to say is, before bothering other people, DEBUG your project. Oh, and once you've done it, and your project inserts your data, read up on sql injection. And parameterized queries. And how to store your connection string in web.config.

    var question = (_2b || !(_2b));

    ASP.NET csharp help asp-net sysadmin security

  • query
    G Greg Chelstowski

    You've tried using sqlinjection? Oh... :wtf:

    var question = (_2b || !(_2b));

    --

    Mr Mackey from South Park said:

    And remember children, there are no stupid questions, just stupid people

    ASP.NET database help tutorial announcement

  • How to Connect Local Database Server in Button Click With C#.net ?
    G Greg Chelstowski

    Dont you go round encouraging him now! ;)

    var question = (_2b || !(_2b));

    C# csharp database sysadmin tutorial question

  • multi-user winforms application
    G Greg Chelstowski

    An Enigma wrote:

    2. Once logged in, how will the application know which user is which and to update the logged in user's particular entries?

    Well this part sort of says: "I can't tell the difference between a winform and a webform", with all due respect. Each instance of your "application" will have to be installed on each computer you will ever want to use it on, right? Then when you log in, just keep your user id, name, or shoe-size in a global variable than you can access later. Bah, go crazy, make it a static! And use it in your PARAMETERIZED queries in the WHERE clause ;> What's your ChangePassword class supposed to do, again?

    var question = (_2b || !(_2b));

    C# csharp database question php winforms

  • multi-user winforms application
    G Greg Chelstowski

    SeMartens wrote:

    Second: The way you validate username and password is not really the safest one.

    Safest? It's flawed badly! Of course you can only log in as the last user in the db, because that's when your while loop ends. Even when and if your username and password is correct for some other user, and you set the count variable to 1, the next time the loop.. .erm... loops it will change it back to 2. Unless it's the last record. To the author: But yeah, the way you do it is really ugly, though. Imagine you had 500k users. Would you put all the records in the memory then, and iterate through them? Ever heard of the "WHERE" clause for T-Sql? ;>

    var question = (_2b || !(_2b));

    C# csharp database question php winforms

  • How to send a big file(more than 4 GB) use asp.net
    G Greg Chelstowski

    Show me one server that would accept such a giant first. I've seen my share of useless notions and bad designs and if that guy's clients decide to go through with it I'll nominate them for the Clueless Jack award.

    var question = (_2b || !(_2b));

    ASP.NET csharp asp-net sysadmin help tutorial

  • datagrid combobox column
    G Greg Chelstowski

    I understand you have set the DataSource of the DataGridViewComboBoxColumn, as well as its DisplayMember and ValueMember properties. When you have done so, just set the ValueType property of it, like so:

    ((DataGridViewComboBoxColumn)dataGridView1.Columns[2]).ValueType = typeof(Int32);

    Obviously, changing the name of dataGridView1 to your datagridview's name and the index (in this instance: 2) to the index of your combobox column. Hope it helps.

    var question = (_2b || !(_2b));

    C# question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups