c# 提示“从索引 47 处开始,初始化字符串的格式不符合规范。”
privatevoidForm1_Load(objectsender,EventArgse){this.listView1.Columns.Add("姓名");this....
private void Form1_Load(object sender, EventArgs e)
{
this.listView1.Columns.Add("姓名");
this.listView1.Columns.Add("性别");
this.listView1.Columns.Add("年龄");
this.listView1.Columns.Add("地址");
第47行 SqlConnection Conn = new SqlConnection(strcom);
string sql = "select * from stuinfo";
SqlCommand cmd = new SqlCommand(sql, Conn);
Conn.Open();
SqlDataReader sdr = cmd.ExecuteReader();
while (sdr.Read())
{
ListViewItem lvi = new ListViewItem();
lvi.Text = sdr[0].ToString();
lvi.SubItems.Add(sdr[2].ToString());
lvi.SubItems.Add(sdr[3].ToString());
lvi.SubItems.Add(sdr[5].ToString());
lvi.ImageIndex = 0;
this.listView1.Items.Add(lvi);
} 展开
{
this.listView1.Columns.Add("姓名");
this.listView1.Columns.Add("性别");
this.listView1.Columns.Add("年龄");
this.listView1.Columns.Add("地址");
第47行 SqlConnection Conn = new SqlConnection(strcom);
string sql = "select * from stuinfo";
SqlCommand cmd = new SqlCommand(sql, Conn);
Conn.Open();
SqlDataReader sdr = cmd.ExecuteReader();
while (sdr.Read())
{
ListViewItem lvi = new ListViewItem();
lvi.Text = sdr[0].ToString();
lvi.SubItems.Add(sdr[2].ToString());
lvi.SubItems.Add(sdr[3].ToString());
lvi.SubItems.Add(sdr[5].ToString());
lvi.ImageIndex = 0;
this.listView1.Items.Add(lvi);
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询