日期:2014-05-17 浏览次数:20714 次
string id = dr["PostID"].ToString();//保存Post的ID
SQLServer SQLResponse = new SQLServer();
string ResponseSQLString = "SELECT ResponseTable.Responser,ResponseTable.ResponseContent FROM ResponseTable WHERE ReponseTable.PostID = @id";//这是查询字符串
public DataTable select(string Connectionstring, string sql)
{
SqlConnection conn = new SqlConnection(Connectionstring);
DataTable dt = new DataTable();
SqlDataAdapter adpter = new SqlDataAdapter(sql,conn);
try
{
conn.Open();
adpter.Fill(dt);
}
catch (SqlException)
{ }
finally {
conn.Close();
}
return dt;
}