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
Vuk Stanojevic
1.6k
140
44.9k
SqlDataAdapter s = new SqlDataAdapter(query, con); DataTable
Feb 27 2018 12:00 PM
Dear all ,
this is my code , it doesn't show any error , builded successfully but it doesn't work when i try to test it :
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 WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\vukst\Documents\users.mdf;Integrated Security=True;Connect Timeout=30;");
string query = "Select Count(*) from ltbl Username = '" + textBox1.Text.Trim() + "' and Password = '" + textBox2.Text.Trim() + " ' ";
SqlDataAdapter s = new SqlDataAdapter(query, con);
DataTable ltbl = new DataTable();
s.Fill(ltbl);
if (ltbl.Rows.Count == 1)
{
this.Hide();
Form2 ss = new Form2();
ss.Show();
}
else
{
MessageBox.Show("Please check your username and password");
}
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
It says : ccc
it marks letter s in following 2 rows :
SqlDataAdapter s = new SqlDataAdapter(query, con);
s.Fill(ltbl);
Reply
Answers (
2
)
comment je manipule un combobox dans une datagridview en c#
my dropdrown is not loaded in the data is already datatable