Click here to Skip to main content
15,914,303 members
Home / Discussions / Database
   

Database

 
Questionwhat is the data type that is case sensiteive in SQL 2005 Pin
Big Ralph28-Aug-07 21:22
Big Ralph28-Aug-07 21:22 
AnswerRe: what is the data type that is case sensiteive in SQL 2005 Pin
SHatchard28-Aug-07 21:43
SHatchard28-Aug-07 21:43 
GeneralRe: what is the data type that is case sensiteive in SQL 2005 Pin
Big Ralph28-Aug-07 23:17
Big Ralph28-Aug-07 23:17 
Questiondatatime format problem. Pin
david bagaturia28-Aug-07 20:56
david bagaturia28-Aug-07 20:56 
AnswerRe: datatime format problem. Pin
Rami Said Abd Alhalim29-Aug-07 4:40
Rami Said Abd Alhalim29-Aug-07 4:40 
AnswerRe: datatime format problem. Pin
Masoumeh...29-Aug-07 4:50
Masoumeh...29-Aug-07 4:50 
AnswerRe: datatime format problem. Pin
shivvish30-Aug-07 22:48
shivvish30-Aug-07 22:48 
QuestionFrom Microsoft Access to MS SQL Server 2005 Pin
Bonsta28-Aug-07 20:24
Bonsta28-Aug-07 20:24 
This code below connected to a Access Database. I want to make it connect to a SQL Server 2005(As u can see, I have a server connection string)..Are there any changes that I need to make to the methods of the OleDb Class or any other class because its not working.




private void btnLogin_Click(object sender, System.EventArgs e) <br />
          { <br />
            //The connection string is used to describe the type of database, the security information and the location to the database. <br />
            string ConString = "Data Source=porky;Initial Catalog=IS3_sysdev;Integrated Security=True"; <br />
            //Create a new connection object and assign the ConString Connection String above <br />
            OleDbConnection DBCon = new OleDbConnection(ConString); <br />
            // g_login is a global variable defined in a Module that captures the login name and passes it from form to form. To create this, just create a Module, say Module1.vb and in it put "Public g_login as String" {g meaning global and login to represent the global login} <br />
            GlobalVariables.g_login = this.textBox1.Text; <br />
            <br />
            string strPassword = this.textBox2.Text;<br />
<br />
            if (GlobalVariables.g_login == "" || strPassword == "")<br />
            { <br />
                MessageBox.Show("You are missing information. Please make sure that both the username and password fields are filled out.", "Missing Info"); <br />
                this.textBox1.Focus(); <br />
                return; <br />
            } <br />
            // The database has two fields in the Users table. A UserID field, which is the primary key and declared as a text. The other field is Password, which is a text as well. <br />
            string strsql = "SELECT [UserID], [Password] FROM Users WHERE [UserID]='" + GlobalVariables.g_login + "' "; <br />
            <br />
            OleDbCommand cm = new OleDbCommand(strsql, DBCon); <br />
            OleDbDataReader dr; <br />
            bool valid = false; <br />
            bool HasRows = false; <br />
            try { <br />
                DBCon.Open();<br />
                dr = cm.ExecuteReader(); <br />
                if (dr.HasRows) { <br />
                    while (dr.Read()) { <br />
                        if (strPassword == dr.GetString(1)) { <br />
                            valid = true; <br />
                        } <br />
                    } <br />
                    HasRows = true; <br />
                } <br />
                dr.Close(); <br />
            } <br />
            catch (OleDbException exO) { <br />
                MessageBox.Show(exO.Message); <br />
            } <br />
            catch (Exception ex) { <br />
                MessageBox.Show(ex.Message); <br />
            } <br />
         //   finally { <br />
           //     if (DBCon.State == ConnectionState.Open) { <br />
             //       DBCon.Close(); <br />
               // } <br />
           /*     cm = null; <br />
                dr = null; <br />
                DBCon.Dispose(); <br />
                GC.Collect(); */<br />
           // } <br />
            iCount = iCount + 1; <br />
            if (valid == true) {<br />
                Form n = new Form4();<br />
                n.Show();<br />
                this.Hide();<br />
            } <br />
            else if (iCount == 3) { <br />
                MessageBox.Show("Contact Developers!", "Invalid Info"); <br />
                this.Close(); <br />
            } <br />
            else if (HasRows == false) { <br />
                MessageBox.Show("Invalid user name, try again!", "Invalid Info"); <br />
                this.textBox1.Focus(); <br />
                this.textBox1.Text = ""; <br />
                this.textBox2.Text = ""; <br />
            } <br />
            else { <br />
                MessageBox.Show("Invalid password, try again!", "Invalid Info"); <br />
                this.textBox2.Focus(); <br />
                this.textBox2.Text = ""; <br />
            } <br />
            <br />
       }


Thanks in Advance....

I bis th bit

AnswerRe: From Microsoft Access to MS SQL Server 2005 Pin
blackjack215029-Aug-07 0:24
blackjack215029-Aug-07 0:24 
AnswerRe: From Microsoft Access to MS SQL Server 2005 Pin
Rob Graham29-Aug-07 5:47
Rob Graham29-Aug-07 5:47 
Questionhow i run the .sql file in either microsoft SQL 2005? Pin
sherjeel28-Aug-07 6:09
sherjeel28-Aug-07 6:09 
AnswerRe: how i run the .sql file in either microsoft SQL 2005? Pin
Mike Dimmick28-Aug-07 9:38
Mike Dimmick28-Aug-07 9:38 
Questioncan't find childrows.... Pin
gericooper28-Aug-07 6:04
gericooper28-Aug-07 6:04 
AnswerRe: can't find childrows.... Pin
gericooper28-Aug-07 19:52
gericooper28-Aug-07 19:52 
QuestionTranspose in SQL Pin
Elizma28-Aug-07 1:54
Elizma28-Aug-07 1:54 
AnswerRe: Transpose in SQL Pin
Pete O'Hanlon28-Aug-07 2:21
mvePete O'Hanlon28-Aug-07 2:21 
GeneralRe: Transpose in SQL Pin
Elizma28-Aug-07 3:37
Elizma28-Aug-07 3:37 
AnswerRe: Transpose in SQL Pin
John-ph29-Aug-07 3:49
John-ph29-Aug-07 3:49 
Question. MDF Pin
plural28-Aug-07 1:37
plural28-Aug-07 1:37 
AnswerRe: . MDF Pin
Colin Angus Mackay28-Aug-07 2:32
Colin Angus Mackay28-Aug-07 2:32 
GeneralRe: . MDF Pin
plural28-Aug-07 2:41
plural28-Aug-07 2:41 
QuestionGetting Last Day of Month: Pin
Shahzad.Aslam28-Aug-07 1:30
Shahzad.Aslam28-Aug-07 1:30 
AnswerRe: Getting Last Day of Month: Pin
mihirhp28-Aug-07 1:53
mihirhp28-Aug-07 1:53 
GeneralRe: Getting Last Day of Month: Pin
Shahzad.Aslam28-Aug-07 3:34
Shahzad.Aslam28-Aug-07 3:34 
QuestionRadioButtons are not working Pin
RaveRare27-Aug-07 18:46
RaveRare27-Aug-07 18:46 

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.