How to show image from database and price of that image using param sql query?

Recommended Answers

All 3 Replies

Are you asking for the SQL command text that extracts the price and image url using some filter as parameters?
If yes, and assuming you use the stock code to find the product you would do this:
I'm using MySql as you didn't specify the database you are using.

MySqlCommand cmd = new MySqlCommand();
cmd.Connection = // your connection string
cmd.CommandText = "SELECT price, image FROM yourTable WHERE id = ?product_id";
cmd.Parameters.Add("?product_id", MySqlDbType.Varchar (or int if that is what you are using)
cmd.Parameters["?product_id"].value = variable holding product_id

Open your connection and execute the command on a dataadapter or reader to hold the results and then use them.

Of course, I maybe way off base because your question isn't very specific.
Hope that helps,

I using SQL

Thanks for your help I will try this code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.