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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:37:29+00:00 2026-05-26T14:37:29+00:00

Afternoon All, I have a stored procedure in an SQL 2005 database named GasNominationsRawData_Insert.

  • 0

Afternoon All,

I have a stored procedure in an SQL 2005 database named GasNominationsRawData_Insert.

When executed this simply extracts some data from another database and inserts the result into a table. This query works fine.

What i need to do is enable this to be executed on the click on a button on my web page. I have had a good luck around the internet have have managed to create the following code in my .net 2008 web page. But i think im either missing something or i have have completly the wrong code. Im new to programming in .Net but i understand that i need to delclare the stored procedure, create the SQL connection, create the command line, open the conection, execute the query and then close the connection.

I dont need or have any parameters. Essentially this button is just used to push data to a table.

Imports System.Data
Imports System.Data.SqlClient

Partial Class RawData
Inherits System.Web.UI.Page

Protected Sub btnAddRawData_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddRawData.Click

    'Declare Stored Procedure
    Dim GasNominationsRawData_Insert As String = "GasNominationsRawData_Insert"

    'Declare SQL Connection (This is the connection string located on the web.config page)
    Dim SQLConn As SqlConnection
    SQLConn = New SqlConnection("GasNominationsDataConnectionString")

    'Declare command
    Dim SqlComm As SqlCommand = New SqlCommand("GasNominationsRawData_Insert", SQLConn)
    SqlComm.CommandType = CommandType.StoredProcedure

    Try
        'Open SQL Connection
        SQLConn.Open()

        'Execute Query
        SqlComm.ExecuteNonQuery()

        'Close connection
        SQLConn.Close()

    Catch ex As Exception
        Throw (ex)

    End Try

End Sub

End Class

Any Help is much appreciated.

Regards Betty

  • 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-26T14:37:30+00:00Added an answer on May 26, 2026 at 2:37 pm

    Upps. I overlooked that. You’re trying to connect to your database with the connectionstring: “GasNominationsDataConnectionString”. That’s of course no correct connection string.
    Your connection string should look somehow like that:
    “Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;”
    So you have to get your connection string first out of your web.config like
    Dim GasNominationsDataConnectionString As String = ConfigurationManager.ConnectionStrings(“GasNominationsDataConnectionString”).ConnectionString

    Regards
    Anja

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

Sidebar

Related Questions

Good Afternoon All, I have two tables in my SQL Server 2005 DB, Main
I have been trying all afternoon to try and achieve this with no success.
Good Afternoon All, I have written an SSIS 2005 package that contains a conditional
I've been pulling my hair out on this one all afternoon. Basically, I have
I have been trying to figure this out all afternoon with no luck. On
Afternoon All I have some data - var searchwithin = [ {id:clearwithin, type:button}, {id:search_radius,
I have been trying all afternoon to get the jQuery Sifr Plugin ( http://jquery.thewikies.com/sifr/
Good Afternoon All, I have a wizard control that contains 20 textboxes for part
Afternoon all. I have the following scenario: I have a search page where by
Afternoon all, I really need your help as this is a Nightmare! I was

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.