Home/ASP.NET Forums/Data Access/ADO.NET, Entity Framework, LINQ to SQL, NHibernate/how to change cmd.Parameters.Add("@pic", bytePic) to store commands

how to change cmd.Parameters.Add("@pic", bytePic) to store commands [Answered]RSS

5 replies

Last post Nov 28, 2010 03:41 PM by Rockin2009

  • sansan

    sansan

    All-Star

    53932 Points

    8147 Posts

    Re: how to change cmd.Parameters.Add("@pic", bytePic) to store commands

    Nov 18, 2010 03:40 PM|sansan|LINK

    Rockin2009

    but i dont how to use

    cmd.Parameters.Add("@pic", bytePic);   

    Check this sample

    http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson06.aspx

    If your parameter is an image, you need to pass the byte array from the image file/upload control(if you are using file upload control).

    Santhosh
  • manoj0682

    manoj0682

    Star

    8479 Points

    1499 Posts

    Re: how to change cmd.Parameters.Add("@pic", bytePic) to store commands

    Nov 18, 2010 03:47 PM|manoj0682|LINK

    check below link

    Insert Image into Folder and Database 


    Manoj Karkera

  • Rockin2009

    Rockin2009

    Member

    71 Points

    179 Posts

    Re: how to change cmd.Parameters.Add("@pic", bytePic) to store commands

    Nov 28, 2010 02:31 PM|Rockin2009|LINK

     

    conn = new

    SqlConnection("Server=(local);DataBase=Northwind;Integrated Security=SSPI");

    conn.Open();//

    ************************i dont want a connection to be created since i using ado entity framework NorthwindEntities db= new NorthwindEntities();*********

     

    // 1. declare command object with parameter

    SqlCommand cmd = new SqlCommand(

    "insert into Customers (name) values (@name)", conn);

    ***********************//am using db. ExecuteStoreCommand("insert into Customers (name) values (@name)";)*************************************

    // 2. define parameters used in command object

    SqlParameter param = new SqlParameter();

    param.ParameterName = "@name";

    param.Value = inputCity;

    *************************well i can use the above

    // 3. add new parameter to command object

    cmd.Parameters.Add(param);

    ???????????????????????am not using cmd .........how to add parameter

  • mudassarkhan

    mudassarkhan

    All-Star

    79016 Points

    13418 Posts

    Re: how to change cmd.Parameters.Add("@pic", bytePic) to store commands

    Nov 28, 2010 03:14 PM|mudassarkhan|LINK

    Refer here

    http://www.aspsnippets.com/Articles/Save-and-Retrieve-Files-from-SQL-Server-Database-using-ASP.Net.aspx 

    I have explained how to insert binary data in database

    MAK [MVP ASP.Net] ASP.Net Freelancer

    Contact me

  • Rockin2009

    Rockin2009

    Member

    71 Points

    179 Posts

    Re: how to change cmd.Parameters.Add("@pic", bytePic) to store commands

    Nov 28, 2010 03:41 PM|Rockin2009|LINK

    Thats not the question ...and the subject....how to add parameter without using new sqlcommand...am mentioning above...am usin execute store command

  • ‹ Previous Thread|Next Thread ›