ADO.NET :: Linq To Sql - Has Some Invalid Arguments
Oct 6, 2010
I created a dbml fiile and tried it if it works or not. but the sp function is crashing. here is the error;
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following
specific error details and modify your source code appropriately.
Compiler Error Message: CS1502: The best overloaded method match for ',MyDataContext.CustomerDetails_InsertWhilePurchase(ref int?, string, string, string, string, System.DateTime?, string, string,
string, string, string, string)' has some invalid arguments
FYI, In databse I have stored dropdown item text, not value.
Now whenever I try to set the selected item using following code, I am getting error System.Web.UI.WebControls.ListItemCollection.FindByText(string)' has some invalid arguments.
I'm trying to follow the demo from this link to add a jqGrid to an MVC app.
I have a table named Companies that I'm trying to display in a grid. A Company simply contains an ID and a Name.
I'm running into an error in my controller function:
public JsonResult DynamicGridData(string sortIndex, string sortOrder, int page, int rows) { int pageIndex = Convert.ToInt32(page) - 1; int pageSize = rows; var companies = companiesRepository.Companies.OrderBy(sortIndex + " " + sortOrder).Skip(pageIndex * pageSize).Take(pageSize); //Error here ... }
I'm getting an error on the line that is calling OrderBy():
The type arguments for method 'System.Linq.Enumerable.OrderBy(System.Collections.Generic.IEnumerable, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
I really have no idea what the error means, and I haven't been able to find an explanation. I'm not sure what is causing this error on a simple OrderBy function.
I m having one dataset underwhich i have two DataTables ie Contact & Sales Order.In this two table my ContactId field is primary key in both the tables. I cot some code similar to the following code. But when i copy this code two my .net application it me an error saying semicolun expected ,etc as shown bellow.
Error 37 Invalid expression term 'in'
Because of this i m not able to test the code. can any body tell me how can i achive it . I kust want to inner join this two tables & want to store the result in another data table.
I'm passing Ajax arguments from a source ASP.NET page to destination ASP.NET page. The code snippet looks like the following:
[code]....
I'm trying to access the arguments in the script section of the destination aspx file i.e.
[code]...
My specific need for the arguments in the Page_Load of the script section stems from the fact that I am creating a few dynamic Chart controls in the Page_Load which depend on these arguments.
I don't see the arguments in the destination file. I tried to fetch them using Request["name"] and Request["time"].
P.S. - I had this SO post which dealt with launching a new page from the jQuery section of source page and at the end all worked fine except for this argument capture.
I am trying to set up dynamic routes in an MVC app, and I have this so far...
[Code]....
And that is working great for now, the only issue I am having is that I would like to have the ability to specify a comma delimited list of optional arguments in the database that I could pull out like...
I have a MVC project in a test environment with an AsyncController. I have a pair of methods, ...Async and ...Completed and it seems to work well.The thing is that I've seen examples where the Async method has arguments such as....
public void IndexAsync(AsyncCallback callback, object state)
In my project that defintion yields "No parameterless constructor defined for this object." When I remove the arguments like this...
public void IndexAsync()
it runs fine. I'd like to explore some examples that use these arguments. Where do they come from? How can I get them...
I need to pass 4 arguments (3 strings and one comma separated list) from an ASP.NET page to another ASP.NET page using jQuery. The destination page ought to be launched as a separate window, which works fine with the following jQuery snippet:
How can I pass the arguments to the destination page? I am trying to avoid the query string to pass the arguments because:
I don't want to show the url arguments (which can also be very long) in the destination window. There are some special characters like ',/,, & etc. in the string arguments.
Edit: I'm trying to access the arguments in the script section of the aspx file i.e.
<script language="C#" runat="server"> protected void Page_Load ( object src, EventArgs e) { //Creating dynamic asp controls here } </script>
My specific need for the arguments in the Page_Load of the script section stems from the fact that I am creating a few dynamic Chart controls in the Page_Load which depend on these arguments.
The first method accepts a traditional html form post and response writes a JSON string to the page.The second method accepts a JSON value posted via AJAX and returns a serialized object.Both these methods work fine on their own but when put together in the same web service I get this error when calling method1:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
When I remove the arguments from method2 they work.Can anyone suggest why this is happening?
Edit:The problem spans from the argument type of method2. If I change it to a string or simple data type it works fine.As Joel suggests it's probably because Dictionaries can't be serialized.This doesn't seem to affect my requests sent by ajax and only breaks direct form posts to this handler.Therefore my workaround is to put the form post handlers in a separate file by themselves.Not ideal but works for my application.
I have a page which will retrieve data base on drop down lists and place the data onto a gridview. When the data was entered, each field was entered with multi-selected and delmited by a comma. In the database, some fields will have a string with multi information delmited by the comma, for example, Chicago, Atlanta, NYC will be recorded and place in the field in the database. I'm trying to search now but with a dropdown list with Chicago, Atlanta, and NYC being an individual record. If the person selects NYC, all of the records from NYC will appear even though Chicago and Atlanta are part of the string.
When i execute this SP in DB, it works fine. But when i execute from asp.net app it is throwing error: Procedure or function ... has too many arguments specified
GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROC [dbo].[sp_Customer] @brchID char(40), @brchName VARCHAR(50), @userID VARCHAR(50) AS BEGIN TRANSACTION DECLARE @req_pk int DECLARE @customer_org_pk int IF EXISTS(SELECT * FROM [customer] WHERE [org_id] like @brchID) BEGIN SELECT [org_pk] FROM [customer] WHERE [org_id] like @brchID END ELSE BEGIN EXEC sp_get_next_control_no 'organization.org_pk',@customer_org_pk out; INSERT INTO [customer] (org_pk,[org_id],[org_name]) VALUES(@customer_org_pk,@brchID,@brchName) SELECT [org_pk] FROM [customer] WHERE [org_id] like @brchID END --Address Book Entry IF NOT EXISTS(SELECT * FROM [address_book] WHERE [prsn_id] like @userID) BEGIN exec sp_get_next_control_no 'person.prsn_pk',@req_pk out; END IF (@@ERROR <> 0) BEGIN -- Rollback the transaction ROLLBACK RETURN END ELSE BEGIN COMMIT END
Here is my asp method:
public static string Customer(string brchId, string brchName, string userId) { string spName = "st_Customer"; SqlParameter OrgPk = new SqlParameter("@org_pk", SqlDbType.Int); OrgPk.Direction = ParameterDirection.Output; OrgPk.Size = 50; try { SqlHelper.ExecuteNonQuery(Config.ConnectionString, CommandType.StoredProcedure, spName, new SqlParameter("@brchID", brchId), new SqlParameter("@brchName", brchName), new SqlParameter("@userID", userId), OrgPk ); return Convert.ToString(OrgPk.Value); } }
i am getting problem "procedure or function emp_info has toomany arguments specified" while inserting data into two tables using stored procedure.I specified same number of parameters in stored procedure as specified in the apllication.
I have a gridview that has a column of checkboxes in which you use to select a row of data. Once you select a checkbox or multiple checkboxes and click the 'process' button the data from the rows selected should enter a table in a database. It works fine when i check just one checkbox, but when i check more than one i get the following error: 'Procedure or function insCSSampleDet has too many arguments specified.' Below is a copy of my loop
For Each gvrow As GridViewRow In GridView2.Rows Dim CheckBox1 As CheckBox = DirectCast(gvrow.FindControl("CheckBox1"), CheckBox) If CheckBox1.Checked Then SamplesDataSource2.InsertCommandType = SqlDataSourceCommandType.StoredProcedure SamplesDataSource2.InsertCommand = "insCSSampleDet" SamplesDataSource2.InsertParameters.Add("CSHdrRowid", "1") SamplesDataSource2.InsertParameters.Add("CSPartno", DirectCast(gvrow.FindControl("Label2"), Label).Text) SamplesDataSource2.InsertParameters.Add("CSPartDesc", DirectCast(gvrow.FindControl("Label3"), Label).Text) SamplesDataSource2.InsertParameters.Add("CSQty", DbType.Int32, "1") SamplesDataSource2.Insert() End If NextFor Each gvrow As GridViewRow In GridView2.Rows Dim CheckBox1 As CheckBox = DirectCast(gvrow.FindControl("CheckBox1"), CheckBox) If CheckBox1.Checked Then SamplesDataSource2.InsertCommandType = SqlDataSourceCommandType.StoredProcedure SamplesDataSource2.InsertCommand = "insCSSampleDet" SamplesDataSource2.InsertParameters.Add("CSHdrRowid", "1") SamplesDataSource2.InsertParameters.Add("CSPartno", DirectCast(gvrow.FindControl("Label2"), Label).Text) SamplesDataSource2.InsertParameters.Add("CSPartDesc", DirectCast(gvrow.FindControl("Label3"), Label).Text) SamplesDataSource2.InsertParameters.Add("CSQty", DbType.Int32, "1") SamplesDataSource2.Insert() End If Next
I tried using Ajax & Jquery for the following need, but not able to do...
I have Two Forms StringMain.aspx & Returner.aspx.... I have created 4 Divs at StringMain.aspx and a sample text "ToCheck" at First Div.. In the Returner.aspx form page load, i placed a label like this
I have set StringMain.aspx as default running page. So When i run StringMain.Aspx page,
the text i placed in the First Div "To Check" should concat with the label Text "hello" of Returner.aspx and display it together in the First Div of StringMain.aspx like this
After a day of seraching and not finding an answer, I decided to join and post my issue. I'm not sure why I am receiving the subject error considering just yesterday, it was working fine. If more code is needed to provide input on my problem, please let me know and I will get right on it."Dim v As New Vehicle(0)" is the cause of the error. Since this error occurs, a bunch of other errors will pop up not recognizing any of the properties or methods I've created in my Vehilce class. So I am guessing this is the root of the issue.
I'm trying to validate user input into a textbox via a web service.I'm using a Dynamic Data site, with a custom Dynamic Data field to show this particular value. In the dynamic data field I've added a custom validator -