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 7625133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:09:07+00:00 2026-05-31T05:09:07+00:00

I have a code for inserting values in ASP.net using vb. I’m having problem

  • 0

I have a code for inserting values in ASP.net using vb. I’m having problem with my code says login failed, cannot open database.

Dim struser, strpass, stremail As String
            struser = TextBox1.Text
            strpass = TextBox2.Text
            stremail = TextBox4.Text
            'declaring sql connection. 

            Dim thisConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("DatabaseConnection").ConnectionString)

            'Create Command object
            Dim nonqueryCommand As SqlCommand = thisConnection.CreateCommand()


            Try
                ' Open Connection
                thisConnection.Open()

                Dim strcommand As String
                strcommand = "Insert into Account (Username,Password, Email) values ('" + struser + "','" + strpass + "','" + stremail + "')"

                Dim sqlcomm As New SqlCommand(strcommand, thisConnection)
                Dim o As String = sqlcomm.ExecuteNonQuery()


            Catch ex As SqlException
                ' Display error
                MsgBox(ex.ToString())
            Finally
                ' Close Connection
                MsgBox("Success")
                thisConnection.Close()


            End Try

connection string:

<add name="DatabaseConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=o2database.mdf;Integrated Security=SSPI" providerName="System.Data.SqlClient"/>
  • 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-31T05:09:08+00:00Added an answer on May 31, 2026 at 5:09 am

    1) Initial catalog must be name of the schema you are accessing

    2) You may use ‘Server Explorer’ & try to just connect to the database
    from there. Once succeeded just copy the connection string from
    properties & replace your current connection string.

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

Sidebar

Related Questions

I have a problem in php code inserting values into database (I use PHPMyAdmin).
I'm having a small problem with ASP.NET MVC and Entity Framework 4. I have
I have an asp.net application in which I am inserting into an sql table
i have some SQL code that is inserting values from another (non sql-based) system.
I am trying to insert from code behind on an asp.net form, I have
I have a problem inserting the values from checkboxes in an html document into
I am using RequiredFieldValidator in my asp.net program. I have a sign out button
I have this Code Where i am inserting some values in database. I am
Possible Duplicate: php/Mysql query with inserting date fails I have a datepicker code below:
To begin with: Using Entity Framework v4.0. ASP.NET MVC 2.0. Visual Studio 2010. I

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.