Click here to Skip to main content
15,900,818 members
Home / Discussions / Database
   

Database

 
GeneralRe: Connection string loaded from config file Pin
Nigel Mackay31-Dec-09 19:32
Nigel Mackay31-Dec-09 19:32 
QuestionSQL Server 2005 Express edition Registration. Pin
TinyDevices30-Dec-09 1:41
professionalTinyDevices30-Dec-09 1:41 
AnswerRe: SQL Server 2005 Express edition Registration. Pin
Andy_L_J30-Dec-09 3:23
Andy_L_J30-Dec-09 3:23 
GeneralRe: SQL Server 2005 Express edition Registration. Pin
TinyDevices30-Dec-09 19:32
professionalTinyDevices30-Dec-09 19:32 
AnswerRe: SQL Server 2005 Express edition Registration. Pin
Eddy Vluggen30-Dec-09 6:04
professionalEddy Vluggen30-Dec-09 6:04 
GeneralRe: SQL Server 2005 Express edition Registration. Pin
TinyDevices30-Dec-09 19:34
professionalTinyDevices30-Dec-09 19:34 
QuestionRe: SQL Server 2005 Express edition Registration. Pin
Eddy Vluggen31-Dec-09 5:02
professionalEddy Vluggen31-Dec-09 5:02 
QuestionC# SQL express Login Pin
kadaen29-Dec-09 22:56
kadaen29-Dec-09 22:56 
i am working on a project and one section of the program is password prohibitied, i am using visual studio 2010 coding in C# and using SQL express database, the project is working perfectly the only i can not seem to figure out is how to create the login form ... ex. you open the project then click on personal information, window pops up asking for username and password, if the information you neter matches the information that is in the database you will be able to continue if the information is wrong a messagebox will show up saying invalid entry

been looking all over the net for the problem im having but not having any luck with this issue

here is what i have so far
<code>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EasyStorePro
{
    public partial class LoginForm : Form
    {
        public LoginForm()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();

            conn.ConnectionString = "Data Source=KADAEN-PC\\SQLEXPRESS;Initial Catalog=EasyStorePro;Persist Security Info=True;User ID=************;Password=**********";
            string str = ("SELECT username,password FROM dbo.Login WHERE username='"+ tbUsername + "' and password='"+ mtbPassword +"'");

            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(str, conn);

            conn.Open();

            DataTable dt = new DataTable();
            System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(cmd);

            da.Fill(dt);

            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("Welcome");
            }
            else
            {
                MessageBox.Show("Invalid Entry");
            }

            conn.Close();
        }
    }
}

</code>


Thank you for your time
AnswerRe: C# SQL express Login Pin
nagendrathecoder29-Dec-09 23:18
nagendrathecoder29-Dec-09 23:18 
GeneralRe: C# SQL express Login Pin
kadaen29-Dec-09 23:25
kadaen29-Dec-09 23:25 
GeneralRe: C# SQL express Login Pin
nagendrathecoder29-Dec-09 23:33
nagendrathecoder29-Dec-09 23:33 
GeneralRe: C# SQL express Login Pin
kadaen29-Dec-09 23:43
kadaen29-Dec-09 23:43 
GeneralRe: C# SQL express Login Pin
nagendrathecoder29-Dec-09 23:44
nagendrathecoder29-Dec-09 23:44 
GeneralRe: C# SQL express Login Pin
kadaen29-Dec-09 23:54
kadaen29-Dec-09 23:54 
GeneralRe: C# SQL express Login Pin
nagendrathecoder29-Dec-09 23:58
nagendrathecoder29-Dec-09 23:58 
GeneralRe: C# SQL express Login Pin
kadaen30-Dec-09 0:06
kadaen30-Dec-09 0:06 
GeneralRe: C# SQL express Login Pin
nagendrathecoder30-Dec-09 0:13
nagendrathecoder30-Dec-09 0:13 
GeneralRe: C# SQL express Login Pin
kadaen30-Dec-09 2:58
kadaen30-Dec-09 2:58 
GeneralRe: C# SQL express Login Pin
nagendrathecoder30-Dec-09 17:25
nagendrathecoder30-Dec-09 17:25 
AnswerRe: C# SQL express Login Pin
loyal ginger30-Dec-09 15:41
loyal ginger30-Dec-09 15:41 
GeneralRe: C# SQL express Login Pin
c0der200930-Dec-09 23:01
c0der200930-Dec-09 23:01 
GeneralRe: C# SQL express Login Pin
kadaen31-Dec-09 4:14
kadaen31-Dec-09 4:14 
Questioncreate & update account numbersfor existing records Pin
Jassim Rahma29-Dec-09 22:52
Jassim Rahma29-Dec-09 22:52 
AnswerRe: create & update account numbersfor existing records Pin
Andy_L_J30-Dec-09 3:21
Andy_L_J30-Dec-09 3:21 
GeneralRe: create & update account numbersfor existing records Pin
Jassim Rahma31-Dec-09 2:01
Jassim Rahma31-Dec-09 2:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.