我想调用Windows自带的图片浏览器呢
下面一段代码,是通过点击button_2使得picture box显示数据库的图片文件
我想用点击button 的时候能够调用Windows自带的图片浏览器打开图片文件
这个要怎么实现呢···
还有同样的,想调用office打开数据库中的word又要怎么实现呢···
各位大哥帮帮我···
private void button2_Click(object sender, EventArgs e)
{
try
{
//创建数据库连接字符串
string strConn = "Server=PC-201106241704;Integrated Security=True;" + "DataBase= chengdu";
//创建SqlConnection对象
SqlConnection connection = new SqlConnection(strConn);
//打开数据库连接
connection.Open();
//创建SQL语句
string sql = "select 文件名 from XStpTable";
//创建SqlCommand对象
SqlCommand command = new SqlCommand(sql, connection);
//创建DataAdapter对象
SqlDataAdapter dataAdapter = new SqlDataAdapter(command);
//创建DataSet对象
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet, "XStpTable");
int c = dataSet.Tables["XStpTable"].Rows.Count;
if (c > 0)
{
Byte[] mybyte = new byte[0];
mybyte = (Byte[])(dataSet.Tables["XStpTable"].Rows[c - 1]["文件名"]);
MemoryStream ms = new MemoryStream(mybyte);
pictureBox1.Image = Image.FromStream(ms);
}
connection.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}