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
Sivajihero Hero
NA
105
32.4k
Insert same row in database for multiple times
Dec 23 2015 1:47 AM
I need to add a same data multiple times to the database.Its working in sql, but when I apply the querry in asp.net its not working. It shows error near to 'go'. Here is my code.
protected void Button26_Click(object sender, EventArgs e)
{
Control control = null;
if (GridView1.FooterRow != null)
{
control = GridView1.FooterRow;
}
else
{
control = GridView1.Controls[0].Controls[0];
}
string SlNo = (control.FindControl("txtSlNo") as TextBox).Text;
string Code = (control.FindControl("txtcode") as TextBox).Text;
string Qty = (control.FindControl("txtqty") as TextBox).Text;
using (SqlConnection con = new SqlConnection("Data Source=xxxxx;Initial Catalog=xxxxx;User ID=xx;Password=xxxxx"))
{
using (SqlCommand cmd = new SqlCommand())
{
{
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "INSERT INTO [Itable1](Num,Code,Qty) VALUES(@Num,@Code,@Qty) go 4 ";
cmd.Parameters.AddWithValue("@CODE", Code);
cmd.Parameters.AddWithValue("@Num", SlNo);
cmd.Parameters.AddWithValue("@Qty", Qty);
con.Open();
cmd.ExecuteNonQuery();
GridView1.DataBind();
BindData();
con.Close();
}
}
}
}
I need to insert this row 4 times in database.
Reply
Answers (
9
)
Display google analytics webmasters data in desktop applicat
Whatsapp get password error using WART?