开发者

convert 'Image' data type in sql server 2005 to IplImage

Can anyone please help me to convert 'Image' data type in sql server 2005 to IplImage. I am using CLR/vc++. I don't know how to retrieve Image value from database and store and convert to image. Please help me.

I have done some code but it doesn't work.

                     SqlDataAdapter ^da;
         SqlCommandBuilder ^cmdBuilder;
         DataTable ^devandt = gcnew DataTable();
         DataSet ^CustomersDataSet = gcnew DataSet();

         try
                    {

     开发者_Go百科            conNwnd = gcnew SqlConnection(strconString);
                 String^ strSQL = "select picture from pic"; 


         sqlcmd = gcnew SqlCommand(strSQL,conNwnd);

    //byte[] barrImg=(byte[])cmdSelect->ExecuteScalar();  //not working
    /* array<Byte> ^BinaryImg2 =sqlcmd->ExecuteScalar();*/  //not working



    conNwnd->Open();
    int a = sqlcmd->ExecuteNonQuery();
    da = gcnew SqlDataAdapter("select picture from pic", conNwnd);
    cmdBuilder = gcnew SqlCommandBuilder(da);

    conNwnd->Close();

    int dd = da->Fill(CustomersDataSet, "pic");
    devandt = CustomersDataSet->Tables["pic"];
    DataRow ^drow = CustomersDataSet->Tables["pic"]->Rows[0];
    MessageBox::Show( drow["picture"]->ToString(),"info",MessageBoxButtons::OK,MessageBoxIcon::Information);






    }
    catch(System::Exception^ ee)
    {
        MessageBox::Show(ee->Message);
    }


           /* public Image byteArrayToImage(byte[] byteArrayIn)
            {
                 MemoryStream ms = new MemoryStream(byteArrayIn);
                 Image returnImage = Image.FromStream(ms);
                 return returnImage;
            }*/
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜