你已经知道了如何使用SqlCommand和SqlDataReader对象。下面的代码说明了一个使用SqlParameter对象的可运行程序。这样,现在对每一件事情都很熟悉了,除了这篇文章中新的部分:
Listing 1: Adding Parameters to Queries
using System;
using System.Data;
using System.Data.SqlClient;
class ParamDemo
{
你已经知道了如何使用SqlCommand和SqlDataReader对象。下面的代码说明了一个使用SqlParameter对象的可运行程序。这样,现在对每一件事情都很熟悉了,除了这篇文章中新的部分:
Listing 1: Adding Parameters to Queries
using System;
using System.Data;
using System.Data.SqlClient;
class ParamDemo
{