Hello All,
im trying to learn asp.net so im following a video tutorial , but im stack in very bigging ...
let me expliain what i have ,
DataAccess.cs file which is like below :
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI;
using System.Data.SqlClient;
using System.Configuration;
namespace WebApplication3.App_Code
{
public class DataAccess
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["myworkCS"].ToString());
public DataAccess()
{
conn.Open();
}
public void closeconn()
{
conn.Close();
}
public int AddEditeAsset(string MainID, string FullName)
{
SqlCommand cmd = new SqlCommand("AddEditeAsset", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@MainID", MainID);
cmd.Parameters.AddWithValue("@FullName", FullName);
return cmd.ExecuteNonQuery();
}
}
and i have PageDataAcces.cs file like below
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI;
namespace WebApplication3.App_Code
{
public class PageDataAccess:Page
{
protected DataAccess DA = new DataAccess();
protected void Page_unLoad(object sender, EventArgs e)
{
DA.closeconn();
}
}
}
and i have a simple page which contain text box and button
according to the tutorial , i have to right PageDataAccess to inheirt from it , but i get this error as shown in the screen shoot in the link
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddUser.aspx.cs" Inherits="WebApplication3.Admin.AddUser" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<asp:Button ID="btnAdd" runat="server" OnClick="btnAdd_Click" Text="Add" />
</div>
</form>
</body>
</html>
error i get