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
Inderjeet Kaur
NA
24
3.1k
following is my C# to insert data but it do not get inserted. why?
Mar 19 2021 4:09 AM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace sample1
{
public partial class main : Form
{
SqlConnection conn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\lovel\Desktop\inder\Assign3\Assign3\DataG3.mdf;Integrated Security=True;Connect Timeout=30");
SqlCommand cmd;
public main()
{
InitializeComponent();
}
private void studLoginButton_Click(object sender, EventArgs e)
{
conn.Open();
cmd = new SqlCommand("INSERT INTO loginTab('" + txtStudUser.Text + "','" + txtStudPass.Text + "')", conn);
cmd.ExecuteNonQuery();
conn.Close();
MessageBox.Show("Done");
}
}
Reply
Answers (
7
)
Why get Error when I start Black Android Project in Visual studio 2015
How to Upload Image using asp.net core