When I try to call a stored procedure I get an SQL-exception reading "Procedure or function insert_member has too many arguments specified."
As far as I can see the number of parameters in the application match the number of arguments in the stored procedure. I supply 10 parameters in the application and 10 in the procedure. Is the location of the declaration of the argument cgpID a problem?
ALTER PROCEDURE [dbo].[insert_member]
(
@mbrFirstName nvarchar(15),
@mbrLastName nvarchar(15),
@mbrStreetAddress nvarchar(15),
@mbrPostalAddress nvarchar(15),
@mbrTelephoneHome nvarchar(15),
@mbrTelephoneJob nvarchar(15),
@mbrEmail nvarchar(15),
@mbrActivityGroupID int,
@mbrPaymentMethod int
)
AS
INSERT INTO dbo.member(mbrFirstName, mbrLastName, mbrStreetAddress, mbrPostalAddress, mbrTelephoneHome, mbrTelephoneJob, mbrEmail)
Hi everybody, I am having trouble how to fixed this code. I am trying to supply the parameterinside a stored procedure with a value, and displays error message shown below. If I did not supply the parameter with a value, it works. How to fix this?Error Message:Procedure or function <stored proc name> has too many arguments specified.Thanks,den2005 Stored procedure:
Alter PROCEDURE [dbo].[sp_GetIdeaByCategory] @CatId <span class="kwd">int</span> = 0 AS BEGIN SET NOCOUNT ON;
Select I.*, C.*, U.* From Idea I inner join IdeaCategory C on I.CategoryID = C.IdeaCategoryID inner join Users U on I.UserID = U.UserID Where I.CategoryID = @CatId Order By LastModifiedDate Desc End
Can someone help me with this issue? I am trying to update a record using a sp. The db table has an identity column. I seem to have set up everything correctly for Gridview and SqlDataSource but have no clue where my additional, phanton arguments are being generated. If I specify a custom statement rather than the stored procedure in the Data Source configuration wizard I have no problem. But if I use a stored procedure I keep getting the error "Procedure or function <sp name> has too many arguments specified." But thing is, I didn't specify too many parameters, I specified exactly the number of parameters there are. I read through some posts and saw that the gridview datakey fields are automatically passed as parameters, but when I eliminate the ID parameter from the sp, from the SqlDataSource parameters list, or from both (ID is the datakey field for the gridview) and pray that .net somehow knows which record to update -- I still get the error. I'd like a simple solution, please, as I'm really new to this. What is wrong with this picture? Thank you very much for any light you can shed on this.
Hello. I am pretty new to SQL Stored Procedure, and ran into a problem. I am guessing there is a simple solution to this, as I am self-teaching myself this stuff.
I currently have a procedure that creates a new table, by reading in columns from a variety of Linked Servers (ODBC connection to to Sybase databases)
I will want to generalize a procedure by setting as arguments the ODBC connection name and the name of the new table that will be created ("CREATE TABLE") so I can pass these in.
As a test of this idea, I created this as a simple procedure, but I get a syntax error when I try to Check Syntax this. Do I have to do something else when I reference the string "argu1" to specify a new table name, or an OPEN QUERY Linked table name? Thanks and Happy New Year!
CREATE PROCEDURE gis.pr_PARCEL_TEST( @argu1 char(25)) AS CREATE TABLE @argu1 GO
I have the following stored procedure ALTER PROCEDURE dbo.TextEntered @searchString varchar(30) /* ( @parameter1 datatype = default value, @parameter2 datatype OUTPUT ) */ AS Select GAVPrimaryKey, NAME from towns where NAME like @searchString order by NAME
RETURN doesn't work!!!! I would like to produce the following where s is @searchString: Select GAVPrimaryKey, NAME from towns where NAME like 's%' order by NAME Any ideas how I might acomplish this I have tried almost everything !
We have an application written in ASP that calls a MS-SQL stored procedure and passes several parameters. Once in a while, we get this error, but most of the time it works. We can also run this in SQL query analyzer without ever a problem. We've looked at the obvious and found nothing wrong.
Please help! Any suggestions are appreciated. (I posted this in ASP discussion board but no one replied)
Can a Sql Server SP have variable number of arguments??? If yes, can somebody point me to a resource demonstrating that??? I need to send variable number of arguments to some of my SPs & iterate them with either foreach or traditional for loop. Any support would be greatly appreciated.
If variable number of arguments are not feasible, then can I pass them as an array to the SP (again a Sample code would be desirable)???
I have an SqlDataSource control on my aspx page, this is connected to database by a built in procedure that returns a string dependent upon and ID passed in. I have the followinbg codewhich is not complet, I woiuld appriciate any help to produce the correct code for the code file Function GetCategoryName(ByVal ID As Integer) As String sdsCategoriesByID.SelectParameters("ID").Direction = Data.ParameterDirection.Input sdsCategoriesByID.SelectParameters.Item("ID").DefaultValue = 3 sdsCategoriesByID.Select() <<<< THIS LINE COMES UP WITH ERROR 1End Function ERROR AS FOLLOWS argument not specified for parameter 'arguments' of public function Select(arguments as System.Web.DatasourceSelect Arguments as Collections ienumerable
Help I have not got much more hair to loose Thanks Steve
Im getting this error when looping through a gridview. Im trying to save each row into the database. The weird thing is that it saves the first row, but errors out on the second.If I only add one item to the gridview, it works. The second row is screwing it up somehow. Any ideas? ------------------------------------------------------------------------------------------------------------------------------------------------------------------Some of my code to get an idea of how im doing it:(This is for a shopping cart. It displays the products in the shopping cart. If the order is approved by the CC processing company, each product entry is saved in the DB. The gridview is being populated by my ShoppingCart Profile Object.) SqlConnection objConn = new SqlConnection(ConfigurationManager.ConnectionStrings["rdevie"].ConnectionString); SqlCommand objCmd = new SqlCommand("InsertOrderDetails", objConn); objCmd.CommandType = CommandType.StoredProcedure;
Hi,I have a simple stored procedure that basically SELECT some data from database. I am calling this stored procedure using a sqldatasource. The first time I try it, it works perfectly fine. But I get the error message "Procedure or function has too many arguments specified" the second time I try to search for thing. This is the code that I have that called the stored procedure: Session("SearchItem") = txtSearch.Text.Trim SqlDataSource1.SelectCommand = "_MyStoredProcedure" SqlDataSource1.SelectParameters.Add("SearchItem", Session("SearchItem")) SqlDataSource1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure Gridview1.DataSourceID = "SqlDataSource1" Gridview1.DataBind() The following is the code in the stored procedure: CREATE PROCEDURE [dbo].[_MyStoredProcedure] ( @SearchItem nvarchar(255) = NULL)ASSELECT Field1, Field2, Field3 FROM Registration WHERE((@SearchItem IS NULL) OR (Field1 LIKE '%' + @SearchItem + '%') OR (Field2 LIKE '%' + @SearchItem + '%'))GO Please help.Stan
I have two tables: Person (member_no, name) and Participant (participant, member_no) member_no is the primary key in Person.The stored procedure is:CREATE PROCEDURE dbo.InsertRecs@member_no char(10),@name char(10),@participant char(10)ASbegininsert into person (member_no, name)values (@member_no, @name)select @member_no = @@Identityinsert into participant (participant, member_no)values (@participant, @member_no)endGOWhen I run this via the DetailsView control and try to insert a record I always get "Procedure or function InsertRecs has too many arguments specified"If I remove the second table from the stored procedure it works fine.Does anyone have any ideas?
Hello All, I am having a very strange problem which I cannot figure out. I am using the ASP.NET 2.0 SqlDataSource control to insert a news item into a SQL Express database. When inserting the a message I receive the following error: Procedure or function has too many arguments specified However according to me every thing adds up. Can anyone please help me figure out what is wrong? Here is the code: SqlDataSource: <asp:SqlDataSource ID="sqlNews" runat="server" ConnectionString="<%$ ConnectionStrings:FlevoOptiekDB %>" SelectCommandType="StoredProcedure" SelectCommand="dbo.usp_News_ByID" InsertCommandType="StoredProcedure" InsertCommand="dbo.usp_News_Insert" UpdateCommandType="StoredProcedure" UpdateCommand="dbo.usp_News_Update" DeleteCommandType="StoredProcedure" DeleteCommand="dbo.usp_News_Delete" OldValuesParameterFormatString="{0}"> <SelectParameters> <asp:QueryStringParameter Name="p_iNewsID" QueryStringField="news_ID" /> </SelectParameters> <UpdateParameters> <asp:Parameter Name="p_dtmPublished" Type="DateTime" /> <asp:Parameter Name="p_sTitle" /> <asp:Parameter Name="p_sDescription" /> <asp:Parameter Name="p_sStaticUrl" /> <asp:Parameter Name="p_iPhotoID" /> <asp:Parameter Name="p_iNewsID" /> <asp:Parameter Name="p_iAlbumID" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="p_dtmPublished" Type="DateTime" /> <asp:Parameter Name="p_sTitle" /> <asp:Parameter Name="p_sDescription" /> <asp:Parameter Name="p_sStaticUrl" /> <asp:Parameter Name="p_iPhotoID" /> <asp:Parameter Name="p_iAlbumID" /> </InsertParameters> <DeleteParameters> <asp:QueryStringParameter Name="p_iNewsID" QueryStringField="news_ID" /> </DeleteParameters> </asp:SqlDataSource>Stored procedure:ALTER PROCEDURE dbo.usp_News_Insert( @p_sTitle VARCHAR(256), @p_sDescription TEXT, @p_sStaticUrl VARCHAR(256), @p_dtmPublished DATETIME, @p_iPhotoID INT, @p_iAlbumID INT)AS /* SET NOCOUNT ON */ INSERT INTO dbo.tbNews(news_Title, news_Description, news_StaticUrl, news_Published, photo_ID, album_ID) VALUES(@p_sTitle, @p_sDescription, @p_sStaticUrl, @p_dtmPublished, @p_iPhotoID, @p_iAlbumID) RETURN Thanks, Maurits
Hi While coding with ASP.NET 2.0 I came across this error "Procedure or function InsertUpdateArtist_Tracks has too many arguments specified." Its quite frustrating because I dont know what arguments are being referred to because I've clearly assigned the correct parameters with their correct values to this Stored procedure :InsertUpdateArtist_Tracks Please can some help me with this? is there something fundamentality wrong with my code (Below) or is this a know Microsoft stuff up? or by the way I'm using SQL Server 2005 and ASP.NET 2.0 Below is my sample code: .............. 'Insert or Update Artist_tracks table Response.Write("<br><b>Inserting or Updating Artist_tracks table</b>") AT_Title = SearchArtistsResults(i).title AT_Meta_ID = SearchArtistsResults(i).meta_id AT_AA_ID = AA_ID Dim ParamTitle As SqlParameter Dim ParamMeta As SqlParameter Dim ParamAA_ID As SqlParameter dbCommand.CommandText = "InsertUpdateArtist_Tracks" dbCommand.CommandType = Data.CommandType.StoredProcedure dbCommand.Connection = conn ParamTitle = dbCommand.Parameters.Add(New SqlParameter("@AT_Title", Data.SqlDbType.VarChar, 50)) ParamTitle.Value = AT_Title ParamTitle.Direction = Data.ParameterDirection.Input Response.Write("<br>Sent through this Title =" & AT_Title) ParamMeta = dbCommand.Parameters.Add(New SqlParameter("@AT_Meta_ID", Data.SqlDbType.Int)) ParamMeta.Value = AT_Meta_ID ParamMeta.Direction = Data.ParameterDirection.Input Response.Write("<br>Sent through this Meta_id =" & AT_Meta_ID) ParamAA_ID = dbCommand.Parameters.Add(New SqlParameter("@AT_AA_ID", Data.SqlDbType.Int)) ParamAA_ID.Value = AT_AA_ID ParamAA_ID.Direction = Data.ParameterDirection.Input Response.Write("<br>Sent through this AT_AA_ID =" & AT_AA_ID) conn.Open() dbCommand.ExecuteNonQuery() conn.Close() ..................
Hi All, I'm getting this annoying message when I try to call my Sp on an insert. I've executed the SP straight from SQL Server 2005 Express and it works fine. but I think I have a problem how I'm calling it. The SP------------------------------------------------------------------------- ALTER PROCEDURE dbo.spInsertNewProduct( @productName nvarchar(50), @productSummary text, @productDesc text, @productPhoto int, @productFeaturelist text, @productTestimonials text, @productFile1 int, @productFile1_Title nvarchar(50), @productFile2 int, @productFile1_Title nvarchar(50), @NewProductID int OUTPUT)AS -- inserts new product INSERT INTO [tbl_products] ([productName], [productSummary], [productDesc], [productPhoto], [productFeaturelist], [productTestimonials], [productFile1], [productFile1_Title], [productFile2], [productFile2_Title]) VALUES (@productName, @productSummary, @productDesc, @productPhoto, @productFeaturelist, @productTestimonials, @productFile1, @productFile1_Title, @productFile2, @productFile2_Title); -- Read the just-inserted productID into @NewProductID SET @NewProductID = SCOPE_IDENTITY(); ------------------------------------------------------------------------- The DataSource------------------------------------------------------------------------- <asp:SqlDataSource ID="dsproduct" runat="server" ConnectionString="<%$ ConnectionStrings:myConn %>" InsertCommand="spInsertNewProduct" InsertCommandType="StoredProcedure"> <InsertParameters> <asp:Parameter Name="productName" Type="String" /> <asp:Parameter Name="productSummary" Type="String" /> <asp:Parameter Name="productDesc" Type="String" /> <asp:Parameter Name="productPhoto" Type="String" /> <asp:Parameter Name="productFeaturelist" Type="String" /> <asp:Parameter Name="productTestimonials" Type="String" /> <asp:Parameter Name="productFile1" Type="String" /> <asp:Parameter Name="productFile1_Title" Type="String" /> <asp:Parameter Name="productFile2" Type="String" /> <asp:Parameter Name="productFile2_Title" Type="String" /> <asp:Parameter Direction="Output" Name="NewProductID" Type="Int32" /> </InsertParameters> </asp:SqlDataSource>------------------------------------------------------------------------- In code behind I grab params from front end dropdowns:------------------------------------------------------------------------- Sub InsertProduct(ByVal Src As Object, ByVal Args As DetailsViewInsertEventArgs) dsProduct.InsertParameters("productPhoto").DefaultValue = CType(dvEditProduct.FindControl("ddlProdImage"), DropDownList).SelectedValue dsProduct.InsertParameters("productFile1").DefaultValue = CType(dvEditProduct.FindControl("ddlProdFile1"), DropDownList).SelectedValue dsProduct.InsertParameters("productFile2").DefaultValue = CType(dvEditProduct.FindControl("ddlProdFile2"), DropDownList).SelectedValue lblStatus.Text = "Product has been added to the database" End Sub------------------------------------------------------------------------- I can't see how in the VB front end file how there can be too many params? Any help is greatly appreciated!
Thanks in advance, I am getting the "Procedure or function JobsDb_Development_Update has too many arguments specified." error. Below is the sp and the vwd generated sqldatasource, any suggestions? Thanks Nick
Hi,I cant see why this will not work, when i run the page and try and perform a function it clicks me out and underlines SQLCommand.ExecuteNonQuery() with this error Procedure or function sppaintinsert has too many arguments specified Code below: Imports System.IO Imports System.Data Imports System.Data.SqlClientPartial Class admin Inherits System.Web.UI.PageProtected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click Dim strFileName As String Dim strFilePath As String Dim strFolder As String Dim strPicTitle As StringDim SQLConnection As Data.SqlClient.SqlConnectionDim SQLCommand As Data.SqlClient.SqlCommand
strFolder = "C:Documents and SettingsRoss HintonMy DocumentsVisual Studio 2005WebSitesjessicawebsitePictures" strFileName = oFile.PostedFile.FileName strFileName = Path.GetFileName(strFileName) strPicTitle = TextBox1.Text If (Not Directory.Exists(strFolder)) Then Directory.CreateDirectory(strFolder) End If strFilePath = strFolder & strFileName If File.Exists(strFilePath) Then lblUploadResult.Text = strFileName & " already exists on the server!" ElseSQLConnection = New SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|picturesdb.mdf;Integrated Security=True;User Instance=True")SQLCommand = New SqlCommand SQLCommand.CommandType = CommandType.StoredProcedure If DropDownList.SelectedItem.Value = 0 Then SQLCommand.CommandText = "paintingpictures" Else SQLCommand.CommandText = "spdrawinsert" End If SQLCommand.Connection = SQLConnection SQLConnection.Open() SQLCommand.Parameters.AddWithValue("@image", "Pictures" + strFileName) ' sp parameter nameSQLCommand.Parameters.AddWithValue("@Title", strPicTitle) SQLCommand.ExecuteNonQuery() oFile.PostedFile.SaveAs(strFilePath) lblUploadResult.Text = strFileName & " has been successfully uploaded." End If frmConfirmation.Visible = TrueEnd Sub End ClassALTER PROCEDURE paintingpictures @image VARCHAR(50) AS INSERT INTO pictable([image]) VALUES (@image)
Can anybody help me with this error? I am not even sure where to start looking.
i am looping through an arrayList that populates the SqlParameters. I open the database outside the loop, close it outside the loop and execute myCommand.ExecuteNonQuery(); inside the loop for every loop.
The error I am getting is:
System.Data.SqlClient.SqlException: Procedure or function ImportData has too many arguments specified.
I've found that I'm not the first one to get the error
"Procedure or function x has too many arguments specified"
while working with Stored Procedures (which is no surprise at all). But all suggested solutions didn't help, maybe this is because I misunderstood the whole concept. The situation is: On my page there is a FormView control including the EditItemTemplate. The database contains a Stored Procedure called UpdatePersonByID which is working fine as long as executed in Visual Web Developer. Here's the procedure code:
This is not exactly what it will finally have to do, of course the WHERE-clause later will contain an ID comparison. But since I tried to break down my code as much as possible I changed it to what you see right now. Here's the aspx-source (the red stuff is what I think is important):
And then once again a totally different question: Is there a way to post the highlighted aspx or vb code into this forum and keep the colors? i think I've seen that in some posts but didn't wanna do it manually.
I've been on this one all day - and now tearing my hair out. I have a large SQL2005 database (migrated from SQL2000) which I'm trying to replicate using a VB6 front end.
The application and database concerned have been working with no problems using merge replication for the last 5 years - however, I now need to port to SQL 2005.
In the VB6 app, I'm using the SQLMerge9 control to handle the replication side of things. The code I'm using is exactly as per the code which works under SQL 2000, however, I'm getting an error message "Procedure or function sp_MSupdatesysmergearticles has too many arguments specified." when I try to initialize the subscription.
I've seen one other item on the web with this problem, and this was someone trying to replicate a 2005 client with a 2000 server. I'm using SQL2005 both ends with merge replication -the replication is set up for SQL2005 clients only, and the database (which incidentally is being created on the subscriber correctly) is in SQL2005 compatibility mode.
Any help would be gratefully appreciated - I haven't got much hair left now.
The code I'm using is as follows:
On Error GoTo Err_Handler
Set SQLMergeCtl = New SQLMerge Dim strSQL As String Dim cnn As ADODB.Connection
' add subscriber strSQL = "EXEC sp_dropsubscriber '[subscriber name]'" Set cnn = New ADODB.Connection cnn.Open [connection string]
strSQL = "EXEC sp_addsubscriber '[machine name]', 0 , '[user name]', '[password]', @security_mode = 0" On Error Resume Next cnn.Execute strSQL
If Err <> 0 Then MsgBox Error End If
strSQL = "sp_dropmergesubscription @publication = '[publication name], @subscriber = '[machine name]', @subscriber_db = '[subscriber database name]', @subscription_type = 'pull'" cnn.Execute strSQL If Err <> 0 Then MsgBox Error End If
On Error GoTo Err_Handler cnn.Close Set cnn = Nothing
SQLMergeCtl.DistributorSecurityMode = DB_AUTHENTICATION SQLMergeCtl.Distributor = [distributor name - actually same as the publisher] SQLMergeCtl.DistributorLogin = [user name] SQLMergeCtl.DistributorPassword =[password]
Procedure or function sp_AddDealer has too many arguments specified. I am experiencing the 'too many arguments specified' error. I am running on SQL 2005. The Parameters lists on SQL server (when I view a dropdown under the sp name) shows a 'returns integer' (but without the @ the signifies a parameter).I have looked around the forums and haven't seen quite this flavor of this error. My forehead is sore from beating it against the wall... any clue would be appreciated! The error occurs when I click the 'new' link button, enter some data and then click the update link button after ... BOOM - Procedure or function sp_AddDealer has too many arguments specified. Thanks!! Chip Kigar Here is the stored Procedure:
set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgo ALTER PROCEDURE [dbo].[sp_AddDealer] @sCarcareSystem varchar(100), @sDealerName varchar(50), @sDealerPhysAddrStreet varchar(200), @sDealerPhysAddrCity varchar(100), @sDealerPhysAddrState varchar(10), @sDealerPhysAddrZip varchar(20), @nReturnCode bigint output, @nReturnId bigint output AS SET NOCOUNT ON DECLARE @m_nCt bigint SET @nReturnCode = 0 SET @nReturnId = 0 -- VALIDATE IF (@nReturnCode = 0) BEGIN SELECT @m_nCt = COUNT(tblDealers.[_DealerId]) FROM tblDealers WHERE [Dealer Name] = @sDealerName IF (@m_nCt >0) BEGIN SET @nReturnCode = -2000 --'Error for exsiting Dealer' SET @nReturnId = 0 END END -- PROCESS IF (@nReturnCode = 0) BEGIN SET @nReturnCode = -2 --' Error getting new record id' DECLARE @m_nNewRecId bigint SET @m_nNewRecId = 0 EXEC sp_GetNewRecId @m_nNewRecId output IF (@m_nNewRecId > 0) BEGIN SET @nReturnCode = -1 --'Error adding Dealer' INSERT INTO tblDealers ( [_DealerId], [Carcare System], [Dealer Name], [Dealer Phys Addr Street], [Dealer Phys Addr City], [Dealer Phys Addr State], [Dealer Phys Addr Zip] ) VALUES ( @m_nNewRecId, @sCarcareSystem, @sDealerName, @sDealerPhysAddrStreet, @sDealerPhysAddrCity, @sDealerPhysAddrState, @sDealerPhysAddrZip ) SET @nReturnCode = 0 --'Success' SET @nReturnId = @m_nNewRecId END END
Here is the SQLDataSource. I plugged the ID parameter, so I got a schema back, but no data.
I expected Optional ByRef nArg as Integer=123 to setup a sp arg with a default value of 123. Doesn't look like it does. Anybody know what I'm doing wrong?
Also, I can't write a function with a return using AS System.Int32. There is no RETURN sp arg.
I get an error like 'Query failed for the datatset Reportsource.Procedure of function has too many arguments specified.' What could be the reason for this error?? please help me
Hi all - I'm trying to optimized my stored procedures to be a bit easier to maintain, and am sure this is possible, not am very unclear on the syntax to doing this correctly. For example, I have a simple stored procedure that takes a string as a parameter, and returns its resolved index that corresponds to a record in my database. ie exec dbo.DeriveStatusID 'Created' returns an int value as 1 (performed by "SELECT statusID FROM statusList WHERE statusName= 'Created') but I also have a second stored procedure that needs to make reference to this procedure first, in order to resolve an id - ie: exec dbo.AddProduct_Insert 'widget1' which currently performs:SET @statusID = (SELECT statusID FROM statusList WHERE statusName='Created')INSERT INTO Products (productname, statusID) VALUES (''widget1', @statusID) I want to simply the insert to perform (in one sproc): SET @statusID = EXEC deriveStatusID ('Created')INSERT INTO Products (productname, statusID) VALUES (''widget1', @statusID) This works fine if I call this stored procedure in code first, then pass it to the second stored procedure, but NOT if it is reference in the second stored procedure directly (I end up with an empty value for @statusID in this example). My actual "Insert" stored procedures are far more complicated, but I am working towards lightening the business logic in my application ( it shouldn't have to pre-vet the data prior to executing a valid insert). Hopefully this makes some sense - it doesn't seem right to me that this is impossible, and am fairly sure I'm just missing some simple syntax - can anyone assist?
I executed them and got the following results in SSMSE: TopSixAnalytes Unit AnalyteName 1 222.10 ug/Kg Acetone 2 220.30 ug/Kg Acetone 3 211.90 ug/Kg Acetone 4 140.30 ug/L Acetone 5 120.70 ug/L Acetone 6 90.70 ug/L Acetone ///////////////////////////////////////////////////////////////////////////////////////////// Now, I try to use this Stored Procedure in my ADO.NET-VB 2005 Express programming: //////////////////--spTopSixAnalytes.vb--///////////
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sqlConnection As SqlConnection = New SqlConnection("Data Source = .SQLEXPRESS; Integrated Security = SSPI; Initial Catalog = ssmsExpressDB;")
Dim sqlDataAdapter As SqlDataAdapter = New SqlDataAdaptor("[spTopSixAnalytes]", sqlConnection)
'Pass the name of the DataSet through the overloaded contructor
'of the DataSet class.
Dim dataSet As DataSet ("ssmsExpressDB")
sqlConnection.Open()
sqlDataAdapter.Fill(DataSet)
sqlConnection.Close()
End Sub
End Class ///////////////////////////////////////////////////////////////////////////////////////////
I executed the above code and I got the following 4 errors: Error #1: Type 'SqlConnection' is not defined (in Form1.vb) Error #2: Type 'SqlDataAdapter' is not defined (in Form1.vb) Error #3: Array bounds cannot appear in type specifiers (in Form1.vb) Error #4: 'DataSet' is not a type and cannot be used as an expression (in Form1)
Please help and advise.
Thanks in advance, Scott Chang
More Information for you to know: I have the "ssmsExpressDB" database in the Database Expolorer of VB 2005 Express. But I do not know how to get the SqlConnection and the SqlDataAdapter into the Form1. I do not know how to get the Fill Method implemented properly. I try to learn "Working with SELECT Statement in a Stored Procedure" for printing the 6 rows that are selected - they are not parameterized.
I have some code that I need to run every quarter. I have many that are similar to this one so I wanted to input two parameters rather than searching and replacing the values. I have another stored procedure that's executed from this one that I will also parameter-ize. The problem I'm having is in embedding a parameter in the name of the called procedure (exec statement at the end of the code). I tried it as I'm showing and it errored. I tried googling but I couldn't find anything related to this. Maybe I just don't have the right keywords. what is the syntax?
CREATE PROCEDURE [dbo].[runDMQ3_2014LDLComplete] @QQ_YYYY char(7), @YYYYQQ char(8) AS begin SET NOCOUNT ON; select [provider group],provider, NPI, [01-Total Patients with DM], [02-Total DM Patients with LDL],