使用应用程序或脚本:可以使用编程语言(如C#、Python等)编写应用程序或脚本来连接到SQL Server 2005服务器,并执行查询语句来查看数据。以下是使用C#应用程序和ADO.NET连接到SQL Server 2005服务器的示例:
using System;
using System.Data.SqlClient;
class Program
{
static void Main(string[] args)
{
string connectionString = "Data Source=
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
string sqlQuery = "SELECT * FROM
SqlCommand command = new SqlCommand(sqlQuery, connection);
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
// 处理每一行数据
Console.WriteLine(reader.GetString(0));
}
}
}
}
将上述代码中的、、和替换为实际的值,并将替换为要查询的表名。编译并运行该应用程序,即可查看数据。