Click here to Skip to main content
15,613,470 members
Please Sign up or sign in to vote.
1.31/5 (4 votes)
See more:
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();
	}
}
Posted
Updated 21-Oct-21 16:57pm
v2
Comments
Doreen Kam Shu Qing 21-Oct-21 10:34am    
This is the error message which was displayed in Visual Studio 2017. Please assist me in solving this problem

System.NotImplementedException HResult=0x80004001 Message=The method or operation is not implemented. Source=App_Web_mm4tvnwn StackTrace: at MySqlConnection.Open() in c:\BIT10904\administrator.aspx.cs:line 64 at administrator.Upload_Click(Object sender, EventArgs e) in c:\BIT10904\administrator.aspx.cs:line 224
Richard MacCutchan 21-Oct-21 10:46am    
Look at your code; you have three methods which all throw NotImplementedException. So you need to replace those throw statements with the actual implementation of the methods.
Doreen Kam Shu Qing 21-Oct-21 22:56pm    
Could u help to re-edit the part? Because im not certain with which coding im supposed to remove and replaced with. Sorry for the inconvenience

1 solution

You have been given framework software for you to "fill in" with working code.
The idea is that the "not implemented exception" reminds you that you haven't written the code yet and makes it easy to locate the parts you need to complete.

Fill them in with the right code, and replace the throw statements is all you have to do.

BTW: C# and C++ are very different languages which share some common syntax: if you tag your questions with the wrong language, you reduce the number of the correct people who will look at it, and thus the chances of a helpful reply ...
 
Share this answer
 
v2
Comments
Doreen Kam Shu Qing 21-Oct-21 22:59pm    
Could you assist with further information? Or maybe step by step. Yes ive take note of the tags thank you for reminding.
OriginalGriff 22-Oct-21 2:11am    
What further information do you need?
The methods are there for you to fill in with actual code to do what your task requires.
What do you expect me to do?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900