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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:39:01+00:00 2026-05-26T15:39:01+00:00

I am trying to run what I thought was a rather simple parameterized insert

  • 0

I am trying to run what I thought was a rather simple parameterized insert query, but am running into all sorts of problems. SQL EXPRESS 08R2, VB.net

Here is the VB code that builds the parameters…
UPDATED Variable names:

itemDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings("MyConnectionString").ToString()
itemDataSource1.InsertCommandType = SqlDataSourceCommandType.StoredProcedure
itemDataSource1.InsertParameters.Add("@short_Text", short_Text) 
itemDataSource1.InsertParameters.Add("@foreignTable", foreignTable)
itemDataSource1.InsertCommand = "usp_insertLangShortText"         ' Call stored procedure

'***********************************************************************
 ' Begin the insertion. Check for errors during insert process.

Dim rowsAffected As Integer = 0
rowsAffected = itemDataSource1.Insert()

And here is the SP that I am trying to perform the insert with..

@short_Text varchar(250), 
@foreignTable varchar(250)

AS
/* SET NOCOUNT ON */
DECLARE @sql varchar(max);

   BEGIN
SET @sql =  'INSERT INTO ' + @foreignTable + ' (short_Text) VALUES (''' + @short_Text + ''')';
   END

print (@sql) 
EXECUTE(@sql); 
SET @sql = '' 

RETURN

ANY suggestions on how to code this more intelligently are welcome.

Here is the error….
System.Data.SqlClient.SqlException: Procedure or function usp_insertLangShortText has too many arguments specified. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) at System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values) at System.Web.UI.WebControls.SqlDataSource.Insert() at par_importExcelDataPTS.GetRootID(String short_Text, Int32 string_id, String dbName, String Lang_code) in C:\Users

  • 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-26T15:39:02+00:00Added an answer on May 26, 2026 at 3:39 pm

    I believe that you may need to add an @ in front of the parameter names when you add them:

    itemDataSource1.InsertParameters.Add("@short_Text", short_Text) 
    itemDataSource1.InsertParameters.Add("@foreignTable", foreignTable)
    

    Also, if your short_text contains any single quotes, the SQL will fail to evaluate. To resolve this, replace all single quotes in short_Text with two single quotes.

    If this does not resolve your issue, can you post the exact error messages that you are receiving?

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

Sidebar

Related Questions

I'm trying to run a php-script on a scheduled basis. So I'd thought crontab
I am trying to run the VS 2008 SP1 installer , but it says
I'm trying to run WatiN tests through continuous build on TFS, but I can't
Trying to implement what I thought was a simple concept. I have a user
Trying to run a simple script attached to my xcode project as follows... if
I am getting the following error when trying to run reports. any thoughts or
I am trying run a program from a qmake .pro file which modifies the
Situation: I'm trying run an https store (xcart) under one domain secure.example.com and I
Trying to run the following command in php to run powershell command... the following
Trying to run my program in FreeBSD OS, I have the following results: $

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.