Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2006
    Location
    South Central, KS
    Posts
    81
    Thanks
    2
    Thanked 2 Times in 2 Posts

    MSQL Access without Data Binding

    Hello all -

    Before I become Control Dependent, i would like to understand how Database Access and Direct manipulation of data in ASP.NET is achieved.

    I am having trouble finding anything that addresses this with SQL Server (express) and was hoping someone here could help me.

    in Classic ASP i would create a connection using server.createObject("ADODB.Connection") and then a RecordSet object to which i would feed a query string and if there are returns i could step through them with a

    Do While Not RS.Eof
    Loop

    I've found some info on connecting to MySql DB which allows me similar (if more hoop jumping) access but how do i do this with MS Sql?

    - Also, while on the topic, with MySql there is a DataReader object which allows me to loop through, but i can't seem to access the information by way of field name, only index. is this my only option?

    Thank you in Advance
    -Echo

  • #2
    Regular Coder
    Join Date
    Jun 2008
    Location
    SE Wisconsin, US
    Posts
    222
    Thanks
    1
    Thanked 20 Times in 20 Posts
    First, take a look at http://msdn.microsoft.com/en-us/libr...sqlclient.aspx on MSDN Online. Depending on your needs, you'll want to look at the SqlConnection, SqlDataReader, SQLDataAdapter, and SQLCommand classes. One major difference in .Net is that, with the exception of the DataReader, all data is collected into a disconnected memory dataset so as not to consume server resources by leaving a data stream open for a long time. This does take a little getting used to.

    Regarding the field name reference, see http://msdn.microsoft.com/en-us/library/f01t4cfy.aspx. I have never had a problem with this kind of access. If you're still stuck, post some code and we'll see what we can do.
    Milwaukee Web Designer and SEO Milwaukee Firm specializing in ASP.Net, C#, VB.Net, SQL Server and Access.

  • #3
    New Coder
    Join Date
    Jan 2006
    Location
    South Central, KS
    Posts
    81
    Thanks
    2
    Thanked 2 Times in 2 Posts
    thank you - that's what i finally figured out myself. the links on getting field names are very helpful.

    -Echo


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •