我正在开展一个学生项目(在线购物)。我的项目详细信息,代码背后和所有内容都在此代码行中提及。
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="OnlineShopping.SiteMaster" %>
我有一个想法,我想将产品详细信息(请参阅下面的代码示例)显示到bootstrap卡中。
protected void btnSave_Click(object sender, EventArgs e)
{
string connectionString = "Data Source=.\\SQLEXPRESS;Initial Catalog=onlineShopping;Integrated Security=True";
SqlConnection connection = new SqlConnection(connectionString);
try
{
Byte[] imgByte = (Byte[])ViewState["TheImage"];
string base64String = Convert.ToBase64String(imgByte, 0, imgByte.Length);
ProImage.ImageUrl = "data:image/png;base64," + base64String;
string sqlStatement;
SqlCommand manageCommand;
sqlStatement = "insert into ProductTable values (@ProName, @ProPrice, @ProDescription, @ProPic)";
sqlStatement += " SELECT CAST(scope_identity() AS int);";
manageCommand = new SqlCommand(sqlStatement, connection);
//manageCommand.Parameters.AddWithValue("@ProId", Convert.ToInt32(txtProId.Text.Trim()));
manageCommand.Parameters.AddWithValue("@ProName", txtProName.Text.Trim());
manageCommand.Parameters.AddWithValue("@ProPrice", txtProPrice.Text.Trim());
manageCommand.Parameters.AddWithValue("@ProDescription", txtProDescription.Text.Trim());
manageCommand.Parameters.AddWithValue("@ProPic", imgByte);
connection.Open();
int count = manageCommand.ExecuteNonQuery();
每个产品都应该换上新卡,因为我要添加多少产品,所有产品都应该自带卡片到我的仪表板,而卡片本身应该包含超链接,就像用户点击卡片时一样,它应该重定向到某个页面。希望你有我的意见,请提前回答并表示感谢
答案 0 :(得分:0)