110,008
社区成员




using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Data;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
SqlConnection SqlCon = new SqlConnection("Data Source=;Database=AAA;User id=sa;pwd=SQL4567");
SqlCon.Open();
string SqlStr="SELECT * FROM Table_1 WHERE 班级=1班";
SqlCommand SqlCmd = new SqlCommand(SqlStr, SqlCon);
SqlDataReader SqlRd = SqlCmd.ExecuteReader();
while (SqlRd.Read())
{
Console.WriteLine(SqlRd.GetString());
}
SqlCon.Close();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Data;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int i = 0;
SqlConnection SqlCon = new SqlConnection("Data Source=;Database=AAA;User id=sa;pwd=SQL4567");
SqlCon.Open();
string SqlStr="SELECT * FROM Table_1 WHERE 班级='1'";
SqlCommand SqlCmd = new SqlCommand(SqlStr, SqlCon);
SqlDataReader SqlRd = SqlCmd.ExecuteReader();
while (SqlRd.Read())
{
while (SqlRd[i] != NULL)
{
Console.Write(SqlRd[i].ToString() + " ");
i++;
}
}
Console.WriteLine();
SqlCon.Close();
}
}
}