Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 941255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:05:29+00:00 2026-05-15T22:05:29+00:00

sorry for any inconveniece caused. Would like to ask about database or rather databinding

  • 0

sorry for any inconveniece caused.

Would like to ask about database or rather databinding

My Window look like this: http://i25.tinypic.com/a0x5kn.jpg

The browse button is look up the “My Network Place”

private void browseBtn_Click(object sender, RoutedEventArgs e)
 {
 FolderBrowserDialog dialog = new FolderBrowserDialog();
 Type t = dialog.GetType();
 System.Reflection.FieldInfo fi = t.GetField("rootFolder", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
 fi.SetValue(dialog, 0x0012); dialog.ShowDialog();
 dialog.ShowDialog();
 string selected = dialog.SelectedPath;
 computerText.Text = dialog.SelectedPath;
 }

So now my computerText.Text pass info, for eg: Computer1

Now for the login, I want a database to see whether the info of the computerText is under which username and password. I have already created a database using Microsoft Access which look like this…

id computerName loginID password
1  Computer1      com1    123456
2  Computer2      com2    234567

So i roughly type the command for the loginBtn…

private void loginBtn_Click(object sender, RoutedEventArgs e)
{
 // if the computerText.Text == my datasource's data [computerName] && loginName.Text == my datasource's data [loginID] && password.Text == my datasource's data [password]
 {
  loginStatus.Text = "Login Success!";
 }
 else
 {
  loginStatus.Text = "Login Failed!";
 }

So my question is:

1) How to bind my database that I have now?

2) how to code the above codes that I wanted to do?

Help needed =[

Updated
Have done the following code:

private void loginBtn_Click(object sender, RoutedEventArgs e)
{
OleDbConnection conn;
OleDbCommand comm;
OleDbDataReader dr;
conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|/Database1.accdb");
comm = new OleDbCommand("Select * from Remote where loginId =@id and password=@pass", conn); 
comm.Parameters.Add(new OleDbParameter("@id",System.Data.oleDbType.NVarChar,20, "loginID")); 
comm.Parameters.Add(new OleDbParameter("@pass",System.Data.oleDbType.NVarChar,20, "password"));
conn.Open();
dr = comm.ExecuteReader();
conn.Close();

if (dr.HasRows)
{
loginStatus.Text = "Login Successfully";
}
else
{
loginStatus.Text = "Login Failed!";
string message = "Wrong username/password is been entered!";
string caption = "Alert!";
MessageBoxButton buttons = MessageBoxButton.OK;
MessageBoxImage icon = MessageBoxImage.Warning;
System.Windows.MessageBox.Show(message, caption, buttons, icon);
}
}

Prompt error: “The type or namespace name ‘oleDbType’ does not exist in the namespace ‘System.Data’ (are you missing an assembly reference?)”

And if i Remove the System.Data.oleDbType.NVarChar,20, it works perfectly fine, but when I type according to my database in my username and password, it prompt me Login Failed.. EG:

Computer Name : Computer1
Username: com1
Password: 123456
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:05:30+00:00Added an answer on May 15, 2026 at 10:05 pm

    fMay be something like this, create a connection and than read from your access file.

     OleDbConnection conn;
        OleDbCommand comm;
        OleDbDataReader dr;
        conn = new OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\\db1.mdb");
        comm = new OleDbCommand("Select * from Table1 where loginId =@id and password=@pass",conn);
        comm.Parameters.Add(new OleDbParameter("@id",System.Data.oleDbType.NVarChar,20, "loginID"));
        comm.Parameters.Add(new OleDbParameter("@pass",System.Data.oleDbType.NVarChar,20, "password")); 
    
        conn.Open();
        dr = comm.ExecuteReader();
        conn.Close();
    if(dr.hasrows)
    {
    //login success
    }
    else
     //login fail
    

    Than you can authenticate by using dr against the user input. Put this above your commented line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry about the extremely vague question title (any suggestions for improvements welcome) I have
Sorry if this is too remedial or repetitive in any way but I need
Sorry for this silly question, but is there any way to restrict using directives
Sorry if this is a dup; I haven't found any questions that pose quite
This is my first time using this site so sorry for any bad formatting
This may be a silly question and sorry for any confusing sentences.. I don't
I'm a Pyro and CI noob, so sorry for any obvious omissions. I'm building
Sorry I cannot post any source code... I have a code running a master/slave
sorry in advance for any orthographic mistakes (english is not my first language). I
UPDATE Turns out I'm just tired. There isn't any problem here sorry for wasting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.