sql2000企业管理器中编的
如图:无显示
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;namespace 数据库
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent(); } private void Form1_Load(object sender, EventArgs e)
{
string strRow = "";
string sqlstr = "select * from [fk].[dbo].[kss]";
string str = "server=(local);Integrated Security=SSPI;database=fk";
SqlConnection con = new SqlConnection(str);
con.Open();
SqlCommand cmd = new SqlCommand(sqlstr, con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
strRow = dr.GetString(0);
strRow = strRow + ":" + dr.GetString(1);
strRow = strRow + ":" + dr.GetString(2);
strRow = strRow + ":" + dr.GetString(3); listBox1.Text = listBox1.Text + strRow + (char)10 + (char)13;
}
dr.Close();
con.Close();
label1.Text = "学生信息";
}
}
}
如图:无显示
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;namespace 数据库
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent(); } private void Form1_Load(object sender, EventArgs e)
{
string strRow = "";
string sqlstr = "select * from [fk].[dbo].[kss]";
string str = "server=(local);Integrated Security=SSPI;database=fk";
SqlConnection con = new SqlConnection(str);
con.Open();
SqlCommand cmd = new SqlCommand(sqlstr, con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
strRow = dr.GetString(0);
strRow = strRow + ":" + dr.GetString(1);
strRow = strRow + ":" + dr.GetString(2);
strRow = strRow + ":" + dr.GetString(3); listBox1.Text = listBox1.Text + strRow + (char)10 + (char)13;
}
dr.Close();
con.Close();
label1.Text = "学生信息";
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货