C#使用SqlConnection,SqlCommand,SqlDataReader和SqlParameter,写一个方法从数据库中读数据。

要求回答者把代码贴出来!

string StrSql = "select b_blob,ct_type,ct_name from T_MIS_BLOB where CT_ID='" + id + "' ";
SqlCommand MyCom = new SqlCommand(StrSql, myconn);
myconn.Open();
SqlDataReader dt = MyCom.ExecuteReader();
dt.Read();
byte[] buffer = (byte[])dt[0];
string DocType = dt[1].ToString();
string fileName = dt[2].ToString() + DocType.ToString();
myconn.Close();
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-09-26
现成的完整程序。
http://blog.sina.com.cn/s/blog_6439f26f0100utyj.html
这里可以参考一下。
相似回答
大家正在搜