Help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ken Foskey

    Help

    I am a new VS and C# developer with 20 plus years programming experience
    and I am finding the database stuff incredibly frustrating. I have read
    programming c# 3.0 pretty much cover to cover, the c# cookbook does not
    seem to have any database stuff (it is not obvious anyway). Even
    committing a record is counter intuitive needing help from the
    newsgroup. Despite all the clever gui stuff I would not give VS a high
    rating for DB programming.

    I need a fast start on database programming and interactions with
    databinding. What would be the best place to read up on this so that I
    am not struggling. What is the best place to post questions? I seem to
    get no response on
    microsoft.publi c.dotnet.framew ork.windowsform s.databinding

    Please help me with some pointers, I have to deliver a solution urgently.

    Thanks
    Ken
  • Leon Jollans

    #2
    Re: Help

    What are you trying to do? when you say "DB programming" do you mean loading
    and saving data to/from a DB? or do you mean writing database side functions
    or stored procedure programming? Are you talking about databinding in a
    windows application or in a web site? I'm sorry for the obvious question,
    but I'm not sure where to start otherwise.

    as far as database programming goes, it's basically all SQL so as long as
    you know SQL and you can issue a SQL command to a database, you can do most
    things. Maybe not in the quickest, most elegant fashion, but we all have to
    start somewhere, and throwing over-designed data access approaches at you
    without you first understanding the underlying operations will likely not
    help you much.

    if you want to load data from a SQL query into a data table, this code will
    load and display all the tables in the database specified in the connection
    string.

    DataTable table = new DataTable();
    using(SqlDataAd apter adapter = new SqlDataAdapter(
    "select * from INFORMATION_SCH EMA.TABLES",
    "[your connection string]"))
    {
    adapter.Fill(ta ble);
    }
    foreach(DataRow row in table.Rows)
    {
    Console.WriteLi ne(row["TABLE_NAME "]);
    }

    if you want to view this in a GridView in a web page, you do

    myDataGrid.Data Source = table;
    myDataGrid.Data Bind();

    or if you have a DataGridView in a windows forms app, you only need set the
    datasource, the DataBind call is not required. just set the DataSource, and
    the data wil be shown.

    I'm loth to go into more detail until I know more about what you're trying
    to achieve as it's a potentially huge subject. However if you have more
    specific questions Please ask. Data access is so fundamental to .NET
    programming that someone here will have all the answers you need.

    Leon

    "Ken Foskey" <rmove.foskey@o ptushome.com.au wrote in message
    news:48867ad8$1 @dnews.tpgi.com .au...
    >I am a new VS and C# developer with 20 plus years programming experience
    and I am finding the database stuff incredibly frustrating. I have read
    programming c# 3.0 pretty much cover to cover, the c# cookbook does not
    seem to have any database stuff (it is not obvious anyway). Even
    committing a record is counter intuitive needing help from the
    newsgroup. Despite all the clever gui stuff I would not give VS a high
    rating for DB programming.
    >
    I need a fast start on database programming and interactions with
    databinding. What would be the best place to read up on this so that I
    am not struggling. What is the best place to post questions? I seem to
    get no response on
    microsoft.publi c.dotnet.framew ork.windowsform s.databinding
    >
    Please help me with some pointers, I have to deliver a solution urgently.
    >
    Thanks
    Ken

    Comment

    • Larry Smith

      #3
      Re: Help

      >I am a new VS and C# developer with 20 plus years programming experience
      and I am finding the database stuff incredibly frustrating. I have read
      programming c# 3.0 pretty much cover to cover, the c# cookbook does not
      seem to have any database stuff (it is not obvious anyway). Even
      committing a record is counter intuitive needing help from the
      newsgroup. Despite all the clever gui stuff I would not give VS a high
      rating for DB programming.
      >
      I need a fast start on database programming and interactions with
      databinding. What would be the best place to read up on this so that I
      am not struggling. What is the best place to post questions? I seem to
      get no response on
      microsoft.publi c.dotnet.framew ork.windowsform s.databinding
      >
      Please help me with some pointers, I have to deliver a solution urgently.
      With that much experience you should be able to pick it up reasonably
      quickly with the right book but you're obviously not going to become a
      master overnight. That said, I have as much experience as yourself and a few
      years ago I picked up a copy of "C# Complete" published by Sybex (very
      inexpensive). It's really just a series of chapters on different topics
      written by different authors. Chapters 11-14 in my (older) copy are devoted
      to ADO.NET and lo and behold, I was quite surprised at the breadth of
      coverage. It really does tackle the core topics in very good detail
      (including data binding) and after just a few hours of pouring through it I
      was already very comfortable with things (and surprised at just how
      informative it was). Note that I was also new to C# and .NET at the time. In
      any case, I haven't looked at it in a long time but IIRC it was really more
      for self-starters. New programmers will likely have a tougher time with it
      and there are perhaps better books on the subject, I don't know. An
      experienced developer should have little problem with it however though if
      you're completely new to Windows programming then you may have more hurdles
      then I did (having worked on MSFT platforms since Bill was barely out of his
      parents garage). BTW, don't be too too hard on VS and DB programming in this
      environment. It really is very well designed, only poorly documented
      (something I rant about all the time). Also make sure you read up on
      strongly-typed datasets which is discussed in the book as I recall. You'll
      definitely want to use it. Good luck.


      Comment

      • Ken Foskey

        #4
        Re: Help

        On Wed, 23 Jul 2008 02:14:14 +0100, Leon Jollans wrote:
        What are you trying to do? when you say "DB programming" do you mean
        loading and saving data to/from a DB? or do you mean writing database
        side functions or stored procedure programming? Are you talking about
        databinding in a windows application or in a web site? I'm sorry for the
        obvious question, but I'm not sure where to start otherwise.
        Not overnight, I have been slugging for almost two months. I am very
        experienced so yes overnight is possible, doing it well will take months.
        I am already rewriting old code :-)

        I need help with a post 'disappearing record' on this newsgroup. I just
        found Update(datarow) as opposed to the whole table, maybe that is the
        solution.

        To explain how opaque the descriptions are take master child binding.
        There is not one explanation that I can find that says simply: Check
        your xsd find the relationship between the two tables eg customer and
        orders. Right mouse click and name the relationship reasonably, eg
        CustomerOrders. Every explanation I have seen assumes that step or
        creates a relationship manually in code. I finally got that today.

        I need to sit and really understand this well but I need something to
        read to start with. I learn by reading first.

        Ta
        Ken

        Comment

        Working...