Creating a sql connection in c#

后端 未结 1 1933
谎友^
谎友^ 2021-01-23 12:54

I\'m new to this site and also to programming. I am currently creating an inventory system via a point of sale. It uses modal and non-modal forms. My problem is tho, I\'m workin

相关标签:
1条回答
  • 2021-01-23 12:59

    You can use ExecuteNonQuery like cmd.ExecuteNonQuery(); It returns int value. Use it like this;

    int i = cmd.ExecuteNonQuery();
    

    And also ExecuteReader() works like this;

    SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                Console.WriteLine(String.Format("{0}", reader[0]));
            }
    

    You can read returning data's column. Like first column reader[0], second column reader[1] etc.

    But before all this information, if you are new to programming, you can find a lot of book proposal and useful informations on Stackoverflow. Check these articles;

    • What is the single most influential book every programmer should read?
    • https://stackoverflow.com/questions/477748/what-are-the-best-c-sharp-books
    • https://stackoverflow.com/questions/2018/best-book-for-a-new-database-developer
    0 讨论(0)
提交回复
热议问题