Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Windows.Forms;
- using System.Data.Sql;
- using System.Data.SqlClient;
- namespace WindowsFormsApplication1
- {
- static class Program
- {
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main(string[] args)
- {
- string conectionstring = "Data Source=174.121.133.226;Initial Catalog=cstott_login;User Id=cstott_login;Password=n";
- SqlConnection connection = new SqlConnection(conectionstring);
- try
- {
- connection.Open();
- Console.WriteLine("Connection Open");
- }
- catch (Exception e)
- {
- Console.WriteLine(e);
- Console.Read();
- }
- Console.WriteLine("Username> ");
- string username = Console.ReadLine();
- Console.WriteLine("Password> ");
- string password = Console.ReadLine();
- SqlCommand command = new SqlCommand("SELECT * FROM [login] WHERE Username='" + username + "' AND Password='" + password + "'", connection);
- SqlDataReader reader = null;
- reader = command.ExecuteReader();
- while (reader.Read())
- {
- Console.WriteLine("Welcome: " + reader["username"].ToString());
- Console.Read();
- }
- Console.WriteLine("User: " + username + "does not exist");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement