Results 1 to 2 of 2

Thread: datareaders

  1. #1
    Join Date
    Dec 1969

    Default datareaders

    hi ,<BR>can anyone help me out how to use datareader within another datareader<BR><BR><BR> private void Button11_Click(object sender, System.EventArgs e)<BR> {<BR> compxmlcls obj=new compxmlcls();<BR> obj.connecttodb();<BR> string strSql;<BR> string stritem1;<BR> strSql="select top 10 * from inventtable";<BR> SqlDataReader sdrinvent=nsgetRecords.getRecords.SqlHelper.Execut eReader(obj.sconn,CommandType.Text,strSql);<BR><BR > while (sdrinvent.Read())<BR> {<BR> stritem1=sdrinvent.GetString(0);<BR> strSql="select * from configtable where itemid=&#039;" + stritem1 + "&#039;";<BR> SqlDataReader sdrconfig=nsgetRecords.getRecords.SqlHelper.Execut eReader(obj.sconn,CommandType.Text,strSql);<BR> while (sdrconfig.Read())<BR> {<BR> Response.Write(sdrconfig.GetString(0));<BR><BR><BR > }<BR> sdrconfig.Close();<BR> }<BR> }<BR><BR>thanks in advance<BR><BR>bye<BR>ulaga

  2. #2
    Join Date
    Dec 1969

    Default RE: datareaders

    I would recommend an alternative approach - in the above code you are opening / closing a connection 11 times - which can&#039;t be good for performance - Why not load the related data into a dataset? How are you wanting to display it - Master Detail?<BR>

Posting Permissions

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