using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page 
{
    //string connStr = ConfigurationManager.ConnectionStrings["Connection"].ToString();
  

    protected void Page_Load(object sender, EventArgs e)
    {
       
    }
    protected void btnclear_Click(object sender, EventArgs e)
    {
        txtfname.Text = "";
        txtlname.Text = "";
        txtpssd.Text = "";
        txtcpssd.Text = "";
        txtage.Text = "";
        txtemail.Text = "";

    }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        //SqlConnection con = new SqlConnection(connStr);
        SqlConnection con = new SqlConnection("server=.;database=master;Integrated Security=true;");
        con.Open();
        SqlCommand cmd = new SqlCommand("insert into example values('"+txtfname.Text+"','"+txtlname.Text+"'),con");
        cmd.ExecuteNonQuery();
        con.Close();
    }
}

IM GETTING ERROR PLS RECTIFY THE ERROR AND SOLVE MY PROBLEM PLS my mail <<snip>>

Ketsuekiame commented: 1. Old thread, 2. No code tags, 3. Don't demand, especially in caps +0
Nick Evan commented: I think you should USE MORE CAPS! MAYBE IT'LL HELP! -3
Lusiphur commented: You mean "please help me find the error so *I* can rectify it by doing some work on my own" right? +0

Recommended Answers

All 2 Replies

let us know where the error is occurring and the error is and which line is having the error..?
its difficult for us to analyze where the error is probably to occur..?

The error is in this line.

SqlCommand cmd = new SqlCommand("insert into example values('"+txtfname.Text+"','"+txtlname.Text+"'),con");

Check the position of your quote marks (").

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.