您的位置:首页 > 数据库

转载:操作sql2000中的text,image字段类型.

2007-09-25 10:01 447 查看
以下内容转载于http://www.cnblogs.com/greatqn/archive/2007/03/21/637117.html,

希望楼主,不会介意,我已经注明来源了

在存贮过程里读写text,要用到READTEXT  UPDATETEXT  WRITETEXT  进行操作.

在C#中,用select text from table 是可以直接取到值的.

在做更新,新增操作时,用@text传text的值,也能正常赋值.

text类型直接赋string

image类型用byte[]

insert:

string strSql = "INSERT INTO [dbo].[Tableimg]( [img]) VALUES(@img) ";

using (System.Data.SqlClient.SqlConnection myConnection = new System.Data.SqlClient.SqlConnection(CommConfig.InfodbConnectstring))

string strSql = "SELECT [id], [img] FROM [dbo].[Tableimg] where id = 1 ";

using (System.Data.SqlClient.SqlConnection myConnection = new System.Data.SqlClient.SqlConnection(CommConfig.InfodbConnectstring))

{

{

Byte[] bytes = (byte[])dr[1];

string str = System.Text.Encoding.Default.GetString(bytes);

}

myCommand.Dispose();

myConnection.Close();

}

此文转载于http://www.cnblogs.com/greatqn/archive/2007/03/21/637117.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: