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

  • Home
  • SEARCH
  • 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 6583367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:23:57+00:00 2026-05-25T16:23:57+00:00

I have added a Datasoruce to my current project and the following has been

  • 0

I have added a Datasoruce to my current project and the following has been added to my App.config file:

<connectionStrings>
        <add name="WindowsApplication1.My.MySettings.dbConnectionString"
            connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\db.accdb"
            providerName="System.Data.OleDb" />
    </connectionStrings>

How can I now query and update this datasource?

I have the following query:

Dim sqlstr As String = "INSERT INTO Accounts(Username,Password)VALUES('" & Trim(Account(0)) & "','" & Trim(Account(1)) & "')"

But am not too sure how to actually run the query (New to VB, used to PHP and a single database connection file!)

  • 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-25T16:23:58+00:00Added an answer on May 25, 2026 at 4:23 pm

    How can I now query and update this datasource?

    NOT how you’re doing it right now!

    You have two huge problems with that code:

    1. NEVER use string concatenation to insert values into an sql statement like that.
    2. NEVER store a password as plain text in a database.

    There are ZERO cases where either of those are ever acceptable.

    Here’s one way it might look instead:

    Dim sql As String = "INSERT INTO Account (UserName, PasswordHash) VALUES ( ? , ? )"
    Using cn As New OleDbConnection(ConfigurationManager.ConnectionStrings("dbConnectionString").ConnectionString), _
          cmd As New OleDbCommand(sql, cn)
    
        cmd.Parameters.Add("UserName", OleDbType.VarChar, 50).Value = Account(0).ToString().Trim()
        cmd.Parameters.Add("PasswordHash", OleDbType.Char, 20).Value = HashPassword(Account(1).ToString().Trim())
    
        cn.Open()
        cmd.ExecuteNonQuery()
    End Using
    

    Notice that I changed the name of one of your columns, and that I referrenced a HashPassword() function that doesn’t exist yet. You’ll need to build your own HashPassword() function to go with that code. When building the function, look for an scrypt or bcrypt function to use. Do not use MD5. The best that .Net has built in is SHA1. If you really must go that route (SHA1) you can, but scrypt or bcrypt are greatly preferred (this is why I’m not providing the function for you: it will rely on other code you must first get from the web).

    When you go to authenticate a user, you must then use the same function to hash the attempted password, and compare the hashes rather than the original passwords. This is the only safe way to do it.

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

Sidebar

Related Questions

I have added an external .exe file into my VS2010 setup project and I'd
I have access to a database table that has been added as a datasource
I have added an HTML file to my solution in VS2010. How do you
I have a DataSet that I have added to my project where I can
I have added a service reference to my visual studio project, and now I
I am building a project using Maven. In the Pom.xml i have added dependency
I have a UIActionSheet and I have added the following - UIPickerView and 2
I'm trying to add the country web service to a dropdownlist. I have added
I have populated datagridview using the following method and I have added button column
I have a non databound DGV (no datasource, etc; rows added manually). To filter

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.