问题描述
我正处于一个涉及同时从数据库中读取图像和字符串的项目中。但是我已经尝试了这个,但它仍然不太好
我尝试过:
代码:C#
使用(SqlCommand datas = new SqlCommand(select user.name,user.passport from user where user.id = 1) )
{
SqlDataReader readData = datas.ExecuteReader();
while(readData.Read())
{
label1.Text = readData [0] .ToString();
pictureBox1.Image = readData [1] .ToString();
$ /
}
readData.Close();
}
I am on a project that involves reading image and string from database at the same time. But i have tried this and but it still not well
What I have tried:
code: C#
using(SqlCommand datas=new SqlCommand("select user.name, user.passport from user where user.id=1))
{
SqlDataReader readData=datas.ExecuteReader();
while(readData.Read())
{
label1.Text=readData[0].ToString();
pictureBox1.Image=readData[1].ToString();
}
readData.Close();
}
推荐答案
这篇关于如何在C#中读取SQL数据库中的图像和文本字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!