Here is my entire coding
<pre><%@ Page Language="C#" AutoEventWireup="true" CodeFile="administrator.aspx.cs" Inherits="administrator" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
text-align: center;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<h1 id="Insert" class="auto-style1">Administrator Web Form</h1>
<div style=" background-image:url('https://wallpaperaccess.com/full/3850768.jpg')"
<div style="width: 1000px; height: 305px">
<table border="0" style="width: 1000px; height: 305px">
<tr><td><asp:Label runat="server" ID="Product">Product ID </asp:Label></td>
<th><asp:TextBox runat="server" ID="Product_ID" Placeholder="Product ID"></asp:TextBox></th>
</tr>
<tr><td><asp:Label runat="server" ID="Description">Description</asp:Label></td>
<th><asp:TextBox runat="server" ID="Desription" Placeholder="Description"></asp:TextBox></th>
</tr>
<tr><td><asp:Label runat="server" ID="RM">Price(RM) </asp:Label></td>
<th><asp:TextBox runat="server" ID="Product_Price" Placeholder="Price"></asp:TextBox></th>
</tr>
</table>
</div>
<div id="Photo" style="width:auto; padding-top:0;">
<div class="Photo_1" style="float:left">
<div class="image-size" id="Photo_1" runat="server" style="max-width:100px; max-height:100px; border:groove 1px; margin-top:15px;">
Image</div>
<input type="file" id="IPhoto_1" runat="server"/>
</div>
<div class="Photo_2" style="float:left">
<div class="image-size" id="Photo_2" runat="server" style="max-width:100px; max-height:100px; border:groove 1px; margin-top:15px;">
Image</div>
<input type="file" id="File1" runat="server"/>
</div>
<div class="Photo_3" style="float:left">
<div class="image-size" id="Photo_3" runat="server" style="max-width:100px; max-height:100px; border:groove 1px; margin-top:15px;">
Image</div>
<input type="file" id="File2" runat="server"/>
</div>
<div class="Photo_4" style="float:left">
<div class="image-size" id="Photo_4" runat="server" style="max-width:100px; max-height:100px; border:groove 1px; margin-top:15px;">
Image</div>
<input type="file" id="File3" runat="server"/>
</div>
<div class="Photo_5" style="float:left">
<div class="image-size" id="Photo_5" runat="server" style="max-width:100px; max-height:100px; border:groove 1px; margin-top:15px;">
Image</div>
<input type="file" id="File4" runat="server"/>
</div>
</div>
<div style="text-align:center;">
<asp:Button runat="server" ID="Upload" Text="Upload" OnClick="Upload_Click" Width="180px" />
<br />
<br />
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class administrator : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Upload_Click(object sender, EventArgs e)
{
string connectionstring = @"server=localhost; userid=root; password=password; database=ip_assignment_2";
MySqlConnection myconnect = new MySqlConnection(connectionstring);
try
{
myconnect.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = myconnect;
cmd.CommandText = "insert into product(product_id,description,product_price,photo_1,photo_2,photo_3,photo_4,photo_5)values(?1,?2,?3,?4,?5,?6,?7,?8);";
object Product_ID = null;
cmd.Parameters.AddWithValue("?1", Product_ID);
object Description = null;
cmd.Parameters.AddWithValue("?2", Description);
object Product_Price = null;
cmd.Parameters.AddWithValue("?3", Product_Price);
object Photo_1 = null;
cmd.Parameters.AddWithValue("?4", Photo_1);
object Photo_2 = null;
cmd.Parameters.AddWithValue("?5", Photo_2);
object Photo_3 = null;
cmd.Parameters.AddWithValue("?6", Photo_3);
object Photo_4 = null;
cmd.Parameters.AddWithValue("?7", Photo_4);
object Photo_5 = null;
cmd.Parameters.AddWithValue("?8", Photo_5);
cmd.ExecuteNonQuery();
}
finally
{
myconnect.Close();
}
}
}
internal class MySqlConnection
{
public MySqlConnection(string host)
{
}
internal void Close()
{
throw new NotImplementedException();
}
internal void Open()
{
throw new NotImplementedException();
}
public static implicit operator SqlConnection(MySqlConnection v)
{
throw new NotImplementedException();
}
}
What I have tried:
internal class MySqlConnection
{
public MySqlConnection(string host)
{
}
internal void Close()
{
throw new NotImplementedException();
}
internal void Open()
{
throw new NotImplementedException();
}
public static implicit operator SqlConnection(MySqlConnection v)
{
throw new NotImplementedException();
}
}