C# equivalent ?

sheraz_aries
sheraz_aries used Ask the Experts™
on
HI:
  The given bellow is the code for VB.net ,then what will be the code in C# ?

        dr = ds.Tables(0).Select("", "")
        pcode.Text = CStr(dr(0).Item(0))
        pname.Text = CStr(dr(0).Item(1))
        pprice.Text = CStr(dr(0).Item(2))
        pimage1.ImageUrl = CStr(dr(0).Item(4))
        pimage2.ImageUrl = CStr(dr(0).Item(5))

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
- Replace () with []

- Replace CStr with Convert.ToString()

Author

Commented:
Sijin,  but what about item(0)
      dr = ds.Tables[0].Select("", "");
       pcode.Text = dr[0][0].ToString();
       pname.Text = dr[0][1].ToString();
       pprice.Text = dr[0][2].ToString();
       pimage1.ImageUrl = dr[0][4].ToString();
       pimage2.ImageUrl = dr[0][5].ToString;

Oops, forgot some parens.

      dr = ds.Tables[0].Select("", "");
      pcode.Text = dr[0][0].ToString();
      pname.Text = dr[0][1].ToString();
      pprice.Text = dr[0][2].ToString();
      pimage1.ImageUrl = dr[0][4].ToString();
      pimage2.ImageUrl = dr[0][5].ToString();

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial