First use generics (generate RSS)

namespace Yin
{
public class wares{
public struct arrWare{
public int id;
public string name;
public string desc;
}
#region Get product information
public IList GetWares()
{
IList wares = new List() ;
//IList customer = new List();
strSql = “select top 10 infoName,infos,infoId from WareInfo”;
//IList();
strSql = “select top 10 infoName,infos,infoId from WareInfo”;
@id”, SqlDbType.Int);
//parms.Value = id;
using (SqlDataReader rdr = SqlHelper.ExecuteReader(CommandType.Text, strSql, null))
arrWare ar = new wares.arrWare();
While (rdr.Read())
{
Getar( rd. Getc rd) String
Getc
String
1);
ar.id = rdr.GetInt32(2);
Wares.add (ar);
}
Return Wares;
}
}
#ENDREGION
}

reference method:
WareInfo Wareinfo = new WareInfo();
IList ars = wareInfo.GetWares();
Write foreach (wares.arrWare a in ars)
{m br> node textWriter.WriteStartElement(“item”);
TextWriter(Writer Stringa);
Stringbr> WriteEndElement();
Write EndElement();
// Write to node link
textWriter.WriteStartElement(“link”, “”);
http://www.wordware.com/, 888View 2 id=”+a.id);
textWriter.WriteEndElement();
// write node description
textWriter.Writer.Star tElement(“description”, “”);
Write to ElementD textWriter.Writer.WriteString(a.desc);
Write to “TextWriter.WriteEndElement();
“TextWriter” Pub. , “”);
Write to Element textWriter.WriteString(DateTime.Now.ToString());
Write Element(Start); Author textWriter.WriteEndElement();
Author textWriter.WriteEndElement();
Author “”);
Element textWriter.WriteString(“何永”);
TextWriter.WriteEndElement();
End of write element

End of writing element

}

1.
Since what is obtained is a collection, it should be displayed with a list control, such as GridView

GridView1.DataSource = new arrWare().GetWares();
GridView1.DataBind();

2.
Get a single record
arrWare aw = new arrWare().GetWares()[0];
MyLabel.Text = aw.name;

3.
Actually, here you The arrWare should be defined as class, not struct

4.
In addition, for the method GetWares(), it is more appropriate to define static.

System.Collections.Generic.List ars = GetWares(); foreach (arrWare ar in ars) {Label1. Text += ar.name+”
“; }

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1849 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.