Results 1 to 3 of 3

Thread: [RESOLVED] image dont display

  1. #1

    Thread Starter
    Fanatic Member popskie's Avatar
    Join Date
    Jul 2005
    Location
    In my chair
    Posts
    666

    Resolved [RESOLVED] image dont display

    Hi,
    What is the wrong of my code below the image dont display.Another question is ,It is posible to ugrade my Visual Studio .Net 2001 Enterprise edition to Visual Studio .Net 2003 but in Professional Edition. Many of my Windows Applicaction is backend with MSSQL and using Crystal Report? Professional edition have a Crystal Report?

    //*****************************
    byte[] Photo = null;
    stsqcon.OpenSqlConnectionST();
    SqlDataReader dreader;
    dreader = SelectTable.GetAttachPict();
    dreader.Read();
    //Photo =(byte[])dreader["logo"];

    //Stream myStream = new MemoryStream(Photo, true);

    //myStream.Write(Photo, 0, Photo.Length);
    // pb[index].Image = new Bitmap(myStream);


    CrystalReport2 report=new CrystalReport2();
    //crystalReportViewer1.Visible=true;
    DataSet ds=new DataSet("table1");//give same name as on
    //dataset1 table header
    DataTable table=new DataTable("table1");//give same name as on
    //dataset1 table header
    //p.Image = new Bitmap(myStream);
    table.Columns.Add("test1",typeof(System.String));
    table.Columns.Add("test2",typeof(System.String));
    table.Columns.Add("test3",typeof(System.String));
    table.Columns.Add("test4",typeof(Byte[]));
    for (int i =0;i< 10;i++){
    DataRow row=table.NewRow();
    row["test1"]="Mathew"; // string
    row["test2"]="Hayden"; //string
    row["test3"]="5000$"; // string
    row["test4"]= (Byte[])dreader["logo"]; // base64binary
    // add to table
    table.Rows.Add(row);
    }
    ds.Tables.Add(table);
    // set report's dataset
    report.SetDataSource(ds);
    // set report source
    crystalReportViewer1.ReportSource =report;

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: image dont display

    hey please keep these points in mind when you post
    -wrap your code in [php] tags (or CODE tags). If you don't, your code looks really confusing and people might totally avoid reading your post
    -if there is an error (like in this case), it might be helpful to explain more about it. Give the error message, and the line number, if possible.


    I'm sorry, I hope I'm not being rude
    do you get any errors?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3

    Thread Starter
    Fanatic Member popskie's Avatar
    Join Date
    Jul 2005
    Location
    In my chair
    Posts
    666

    Re: image dont display

    there is no error popup but when the crystal report preview, no image are display.
    It is posible to ugrade my Visual Studio .Net 2001 Enterprise edition to Visual Studio .Net 2003 but in Professional Edition. Many of my Windows Applicaction is backend with MSSQL and using Crystal Report? Professional edition have a Crystal Report?


    Code:
    stsqcon.OpenSqlConnectionST();
    SqlDataReader dreader;
    dreader = SelectTable.GetAttachPict();
    dreader.Read();
    
    
    CrystalReport2 report=new CrystalReport2();
    DataSet ds=new DataSet("table1");
    DataTable table=new DataTable("table1");
    table.Columns.Add("test1",typeof(System.String));
    table.Columns.Add("test2",typeof(System.String));
    table.Columns.Add("test3",typeof(System.String)); 
    table.Columns.Add("test4",typeof(Byte[])); 
    for (int i =0;i< 10;i++){
    DataRow row=table.NewRow();
    row["test1"]="Mathew"; // string
    row["test2"]="Hayden"; //string
    row["test3"]="5000$"; // string
    row["test4"]= (Byte[])dreader["logo"]; // base64binary 
    table.Rows.Add(row);
    }
    ds.Tables.Add(table);
    report.SetDataSource(ds);
    crystalReportViewer1.ReportSource =report;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width