TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
magesh manavalan
NA
331
508.1k
I have four field but i am insert only three field that time show the that error Line Incorrect syntax near ')'.
Dec 26 2011 12:39 AM
Hi...,
I have four field but i am insert only three field that time show the that error Line Incorrect syntax near ')'. i want show the error message you should enter all values.
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;
public partial class _Default : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("Server=(local);initial catalog=TNVKP_12;Trusted_Connection=True");
string str;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
con.Open();
str = "Select * from Project where Projectid=" + TextBox1.Text + "";
SqlCommand cmd = new SqlCommand(str, con);
// cmd = new SqlCommand(str, con);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
Response.Write("Record already exist");
}
else
{
dr.Close();
str = ("insert into Project values(" + TextBox1.Text + ",'" + TextBox2.Text + "','" + TextBox3.Text + "'," + TextBox4.Text + ")");
SqlCommand cmd1 = new SqlCommand(str, con);
cmd1.ExecuteNonQuery();
Response.Write("Record inserted Successfully");
con.Close();
}
}
}
Thanks&Regs.
Magesh.A
Reply
Answers (
2
)
Calling A Console App From A Form App And Some Little Questions
#include and # include 'file'