Following is my code file.
I am getting the following error:
The type or namespace name 'dbconnection' could not be found (are you missing a using directive or an assembly reference?)<br />
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
public partial class Enquiry_Ind : System.Web.UI.Page
{
dbconnection dbcon = new dbconnection();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Ind_Submit_Click(object sender, EventArgs e)
{
dbcon.opencon();
SqlCommand cmd = new SqlCommand("Insert into Indivisual(Name,Age,Mobile_No,Email_Id,Occupation,Location) values('" + Ind_Name.Text + "','" + Ind_Age.Text + "','" + Ind_Mobil_No.Text + "', '" + Ind_Email_Id.Text + "' ,'" + Ind_Occ.SelectedItem.Value + "','"+Ind_Loc.SelectedItem.Value+"')", dbcon.con);
cmd.ExecuteNonQuery();
dbcon.closecon();
SqlCommand cmd1 = new SqlCommand("select max(id) from login_master", dbcon.con );
int id1 = Convert.ToInt32(cmd1.ExecuteScalar());
id1 = id1 + 1;
string name = Ind_Name.Text;
string user_id;
string occ = Ind_Occ.SelectedValue;
if (Ind_Occ.SelectedValue == "Business/Entrepreneur")
{
occ = occ.Substring(0, 2) + occ.Substring(9, 2);
}
else if (Ind_Occ.SelectedValue == "Service-Private")
{
occ = occ.Substring(0, 2) + occ.Substring(8, 2);
}
else if (Ind_Occ.SelectedValue == "HouseWife")
{
occ = occ.Substring(0, 2) + occ.Substring(5, 2);
}
else if (Ind_Occ.SelectedValue == "Service-Govt/Psu/Defence/Army/Armed Force/Civil Services")
{
occ = occ.Substring(0, 2) + occ.Substring(7, 2);
}
else
{
occ = occ.Substring(0, 4);
}
user_id = name.Substring(0, 3) + occ + id1;
string allowedChars = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789!@$?_-";
char[] chars = new char[6];
Random rd = new Random();
for (int i = 0; i < 6; i++)
{
chars[i] = allowedChars[rd.Next(0, allowedChars.Length)];
}
string individual = "Individual";
string pass = new string(chars);
Session["user"] = user_id.ToString();
Session["passwd"] = pass;
SqlCommand cmd2 = new SqlCommand("INSERT INTO login_master (id,User_id,password,user_type) VALUES ( '" + id1 + "' , '" + user_id + "', '" + pass + "', '" + individual + "' )", dbcon .con );
cmd2.ExecuteNonQuery();
Session.Add("LoginID", user_id);
Session.Add("Password", pass);
Server.Transfer("~/Enquiry/Thank u.aspx");
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
[Edited]Code is wrapped in "pre" tags[/Edited]