Can't Get Linq To Recognize That Sproc Has Changed
Dec 21, 2007
I have a GridView that is populated by a stored procedure via linq. I changed the stored procedure to return an additional column, but I can't get the additional column to show up in the GridView. The GridView has autogeneratecolumns=true, so if I were using a SqlDataSource the new column would show up automagically. But now it is not showing up and I cannot reference it. I can't figure out how to make linq recognize that my stored procedure has changed.
I have tried deleting the sproc definition from the dbml file, making sure the partial class is removed the .vb file, refreshing the stored procedures list in database explorer, and adding the sproc definition back again (a hassle), but still it insists on defining only the original columns and not the new column.
How do get linq to get back in sync with the database?
In a system I'm maintaining there is a Stored Procedure calleddbo.MyStoredProcedure. I didn't create this - it was created by adeveloper who has now left. I don't know how the object came by its"dbo." prefix, but I think he created it in QA.Anyway, there were some performance issues (it was taking between 4and 10 seconds to complete) so I copied the SQL into a QA window andit consistently ran in under 1 second. So I created a new SPROC withSQL exactly identical to the old one, but without the "dbo." prefix,and that too runs in <1 second.Any thoughts?Edward
I have attached the results of checking an Update sproc in the Sql database, within VSS, for a misbehaving SqlDataSource control in an asp.net web application, that keeps telling me that I have too many aurguments in my sproc compared to what's defined for parameters in my SQLdatasource control..... No rows affected. (0 row(s) returned) No rows affected. (0 row(s) returned) Running [dbo].[sp_UPD_MESample_ACT_Formdata] ( @ME_Rev_Nbr = 570858 , @A1 = No , @A2 = No , @A5 = NA , @A6 = NA , @A7 = NA , @SectionA_Comments = none , @B1 = No , @B2 = Yes , @B3 = NA , @B4 = NA , @B5 = Yes , @B6 = No , @B7 = Yes , @SectionB_Comments = none , @EI_1 = N/A , @EI_2 = N/A , @UI_1 = N/A , @UI_2 = N/A , @HH_1 = N/A , @HH_2 = N/A , @SHEL_1 = 363-030 , @SHEL_2 = N/A , @SUA_1 = N/A, @SUA_2 = N/A , @Cert_Period = 10/1/06 - 12/31/06 , @CR_Rev_Completed = Y ).
No rows affected. (0 row(s) returned) @RETURN_VALUE = 0 Finished running [dbo].[sp_UPD_MESample_ACT_Formdata]. The program 'SQL Debugger: T-SQL' has exited with code 0 (0x0). And yet every time I try to update the record in the formview online... I get Procedure or function sp_UPD_MESample_ACT_Formdata has too many arguments specified. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Procedure or function sp_UPD_MESample_ACT_Formdata has too many arguments specified.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. I have gone through the page code with a fine tooth comb as well as the sproc itself. I have tried everything I can think of, including creating a new page and resetting the fields, in case something got broken that I can't see. Does anyone have any tips or tricks or info that might help me?
The application (SQL2000 SP4) is running and appears to be functioning OK. The issue is that the SB Server doesn't recognize it, so when I try to add services to SBS, I fails the check. When I try to publish it to the AD, I get error 22039. MSCRM 3.0 is also installed on the same box and is working fine.
What I need to do is get all of the records from T2 that don't match EXACTLY to a record in T1. So I figured a LEFT OUTER JOIN should work:
SELECTT2.* FROMT2 LEFT OUTER JOIN T1 ONT2.C1 = T1.C1 ANDT2.C2 = T1.C2 ANDT2.C3 = T1.C3 WHERET1.C1 IS NULL
But this statement returns the DENISE record when I do this (which has an EXACT match). So, my thoughts took me to the NULL values in T1.C2 and T2.C2 for this record and I thought that, perhaps, the NULL values aren't being recognized as being equal (as they are UNKNOWN). So I started digging around and found SET ANSI_NULLS OFF. I tried it but with no luck. Can you offer any insight on this one? What can I do to have NULL values recognized as being equal?
This is the result set that I would like to have returned in this example:
Our network people changed our machine name one character without our permission, they say their naming standards can't handle an "underscore" we put in our name...now the SQL Server won't run because it doesn't recognize the name of the machine.
Is there a way of bypassing or telling SQL server that we changed the name without having to reload all of our information?
I have MS SQL 2000 Standard edition licensed in "per device" mode on adual xeon. However the properties->Processor tab on EM only list 1 cpu(CPU 0) and has "use all available processors" selected and the use [#]is greyed out.Anybody else experience this? Is it really using both processors? Or doI have some limited product key? I called MS tech support but they werelike, "um that'll be $295 to open a support instance" <*click*>.Thanks!--~zillaPosted via http://dbforums.com
I'm having a strange behavior here, or maybe I'm doing something wrong, I'm not sure.
Anyway, I have a csv file, the Flat File Connection Manager is configured like this: Row delimiter: {CR}{LF} Column delimiter: {;}
For some rows in my file the last two columns are empty and the there is no semicolon for these empty rows but these rows are still ended by a CRLF but SSIS does not consider the CRLF as the end of the row, it consider the first 2 columns of the next row as the last 2 columns of the current row.
I'm using DTS to import a text file (fixed field). In my sample data, I have 21 rows of data.
DTS only brings in 15 or so, because it fails to recognize the CRLF on some of the rows, and just treats it and the subsequent row as part of the previous row.
The text file is being produced via FTP from an IBM Iseries. It imports just fine into Notepad and Excel.
Anyone have any ideas why DTS would have trouble with this ?
I'm sorta new with using stored procedures and I'm at a loss of how to achieve my desired result.
What I am trying to do is retrieve a value from a table before it is updated and then use this original value to update another table. If I execute the first called sproc in query analyzer it does return the value I'm looking for, but I'm not really sure how to capture the returned value. Also, is there a more direct way to do this?
Thanks, Peggy
Sproc that is called from ASP.NET:
ALTER PROCEDURE BP_UpdateLedgerEntry ( @EntryLogID int, @ProjectID int, @NewCategoryID int, @Expended decimal(10,2) ) AS DECLARE@OldCategoryID int
********************************************* BP_GetLedgerCategory ********************************************* ALTER PROCEDURE BP_GetLedgerCategory ( @EntryLogID int ) AS
SELECT CategoryID FROM BP_EntryLog WHERE EntryLogID = @EntryLogID
RETURN
********************************************* BP_UpdateCategories ********************************************* ALTER PROCEDURE BP_UpdateCategories ( @ProjectID int, @NewCategoryID int, @Expended decimal(10,2), @OldCategoryID int ) AS
UPDATE BP_Categories SET CatExpended = CatExpended + @Expended WHERE ProjectID = @ProjectID AND CategoryID = @NewCategoryID
UPDATE BP_Categories SET CatExpended = CatExpended - @Expended WHERE ProjectID = @ProjectID AND CategoryID = @OldCategoryID
create procedure dbo.GetZipID( @City varchar(30), @State char(2), @Zip5 char(6)) as DECLARE @CityID integer declare @StateID integer declare @ZipID integer set @ZipID=2 set @Zip5=lTrim(@Zip5) if @Zip5<>'' SET @ZIPID = (select Min(lngZipCodeID) AS ZipID from ZipCodes where strZipCode=@Zip5) if @ZipID is null set @CityID= EXEC GetCityID(@City); set @StateID= EXEC GetStateID(@State); insert into ZipCodes(strZipCode,lngStateID,lngCityID) values(@Zip5,@StateID,@CityID) if @@ERROR = 0 SET @ZIPID = @@Identity select @ZIPID
GetCityID and GetStateID are two stored procs, how do I execute those two stored procs in the above stored proc? I mean what is the syntax??
I have a maintenance job which has many job steps - checkdb, backup, rebuild index, etc...
I was asked to setup a job which will copy all backup files to a central location.
Now I wrote the script and its working good (part of a new job step)
But, I am now thinking to add some more logic in the job step:-
that is, if the previous job (server maintenance) is successfully completed with the backup job (if completed successfully), then only the copy to location job will start, if the other job step is failed, my copy bkp job will not run.
I'm a report developer who has created some reportsd against sybase data on another server. I am developing on a 64 bit Server 2003 box using SQL 2005 Reporting services. I hace created 32 bit ODBC data dsns using the supplied utitlity (odbcad32.exe). As I am creating the reports I can pull data using the data sources without a problem, however when I deploy my datasource and report to Report manager and run I get the following:
An error has occurred during report processing.
Cannot create a connection to data source 'Chicago_Reporting'.
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
This has been driving me crazy for 2 days now. Any help would be very much appreciated.
I have a simple parent that uses an Execute Package Task to call a simple child package. The child package has a Data Flow that I disabled. When running the child package by itself, the data flow task is bypassed. When running the package via the parent the data flow task executes.
Second issue is when you disable the package configurations in the child, the parent doesn't recognize that it's diables and tries to load the configurations.
It's almost like there are some settings in a child that get ignored by the parent??
I have a Windows Internal Database (installed by SharePoint WSS 3.0) and SQL Server Management Studio Express installed on W2K3 Std server. The server has local hard disk drive C, E, F & G. However SQL Server Management Studio Express only recognize C and E drive, for example in the set default database location or in attach database file dialog window only C & E drive are available. Anyone knows why and how to fix the problem? Thanks
I have an Excel file(.xls) that I need to import to SQL Server database. I am trying to use the Import wizard. However, when I select the file and click next I get the warning "External table is not in the expected format.(Microsoft JET Database Engine)" . I opened the .xls file using a text editor. It looks like some html document.
Hi, i'm new to SSIS and trying to import some csv files (comma delimited) into SQL Server. A NULL value for a CHAR column is correctly regonized as NULl in SQL Server, but a NULL value for of a mapping to a VARCHAR column in SQL Server is not recognized correctly and i get the value "'NULL'" in SQL Server (including the single comma.
Sample:
CSV file contains columns A and B. A and B contains the Text NULL. Column A is mapped to a CHAR field, and column B is mapped to a VARCHAR field in SQL Server. After the import, SQL has the following value: A = NULL as NULL, B 'NULL' as text.
Hi, I just started working with Visual Web Devloper 2005 Express Developer and sql server 2005 Express Edition. My web is hosted with 1and1.com. They have informed me that I can't upload the database generated by the developer software and from what I understand, I will import those files into the mssqlserver database on my site. From my limited understanding, this is done from the backup file that is created from my local sql database. I didn't see a way to do that within VWD 2005 so I downloaded SQL Server Management Studio Express. When I opened it I chose the SQLServer (sqlExpress) located on my computer. The connection seems to work fine. However when I go to open a file and open the database that is in my web I get an error that states that there is no editor and to be sure the aplication for file type .mdf has been installed.
I'm not sure where to go from here or if I'm even on the correct path.
I have just upgraded from Report server 2005 to 2008 r2. I have a program that calls the report server to run some reports but I have getting the error Server did not recognize the value of http header SOAPAction:
[URL] .....
I can log in to the report server and run any report that I want without any issues.
I am using Excel 2013 64bit and use an english Excel version, but with a comma as a decimal seperator and semi-colon as a list seperator.
In Excel everything works fine, but PowerPivot does not properly recognize that I use a semi-colon for formulas.
PowerPivots lets me write formulas with the semi-colon and not the comma, so that is fine.
However, two issues appear:
the yellow smart formula help box that appears when you start typing a formula, thinks I have to use commas, so when I use semi-colons instead, it does not jump to the next parameter.This problem also causes parameters where I have to enter a table or field to not suggest me table and fields when I start typing.Sometimes the formula validation even throws me an exception, that my formula syntax is incorret, ebcause Id id not use a comma. However, commas also do not work. I have to do some weird playing around until it finally accepts my formula.
I hope this buggy behaviour gets fixed, but is there a way I can work around this without changing my formula/list seperator? I also do not want to use a German Excel version, because I am used to the english formulanames.
Hello! I try to get a list of ConditionsVersion where Version is MAX for each ConditionsVersion. I tried something like this (as seen on http://msdn2.microsoft.com/en-us/vcsharp/aa336747.aspx#maxGrouped):
1 List<ConditionsVersion> list = (from cv in ConditionsVersions2 group cv by cv.FKConditions into cv3 select new { 4 PKConditions = cv.PKConditions,5 FKConditions = cv.FKConditions,6 MaxVersion = cv.GroupBy.Max(cv => cv.Version)7 CTimestamp = cv.Timestamp8 }).ToList();
But it doesn't work. It would be great if someone knows why. Thank you!
Well, just played a little bit with that new thing from Microsoft. Genius! Microsoft presented that step backwards as a step forward.
Say good bye to the 3-tier architecture, now any programmer, after 1 week training, will be able to put SELECT * into the source code. No more stored procedures and logic on a server. No more ugly WHERE clauses. Just SELECT * and pass all records in a loop :)
When I looked at the queries, generated by LINQ in SQL profiler, I noticed that they are generated automatically using the same pattern. It is obvious, of course, but now it would be really difficult to trace a problematic query back to the C# code. All updates to table X will look like as identical twins!
On the other side, it is not so bad. We will have soon a lot of projects, failing when they go to the production and face the real volumes of data. And a long queue of companies, crying and asking to save them. Perfect “job security�. Please, use LINQ! Port all your code to LINQ immediately (Laughing demonically like Dr. Evil)
Hm… a second thought, but what could we suggest to these companies, having performance problems with LINQ 3rd party applications, when there is no source code? Now we could at least modify some stored procedures, and with LINQ looks like the only recommendation could be “contact a developer of that application or buy more a powerful server�.
Hullo am using Asp.Net 3.5, I want to create a usercontrol that is supported to all projects to upload file into sqlserver, the user just give the database connection string, tablename, column name depending upon their need, here I develop the code using LINQ technology. I Write a class with simple format like below,
using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.Linq;
This is working but, this is suitable only for single table, I expect depending upon the user input automaticaly the tablename, column name will change in the yellow block codes . Is there any way to update the tablename , columnname from any other class?
I'm new to ASP/VS/Linq and I'm having a small problem. I have one table setup in SQL Server Express 2005 through Visual Studio 2008. The table name is "Users" and has three columns (accountID, userName, email). AccountID is the primary key and set to auto incriment. I've added a couple of records by hand and it works. I have a single form with a button, a label, and two text boxes. The button code is below. After entering some fake data that does not already exist in the database and clicking the button I get this. Cannot insert explicit value for identity column in table 'Users' when IDENTITY_INSERT is set to OFF. I understand that it is trying to insert something into the accountID field but I don't understand why since I'm only providing a username and e-mail address to insert. Your help is greatly appreciated.protected void Button1_Click(object sender, EventArgs e) { MyDatabaseDataContext db = new MyDatabaseDataContext(); var query = from u in db.Users where u.email == txtEmail.Text select u;
var count = query.Count(); if (count == 0) { //Create a new user object. User newUser = new User();
//Add the user to the User table. db.Users.InsertOnSubmit(newUser); db.SubmitChanges(); } else { Label1.Text = txtEmail.Text + " already exists in the database."; }
I have a supplier table with all my suppliers in it. I list them in a gridview. In this gridview, there is a link next to each record to an edit page. Below is the code for the edit page. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim db As New orderLinqDataContext
Dim q = db.selectSupplierByID(Request.QueryString("id")) Dim r As New System.Data.DataTable
txtFriend.Text = q(0).friendlyName txtAdd1.Text = q(0).address1 txtAdd2.Text = q(0).address2 txtAdd3.Text = q(0).address3 txtAdd4.Text = q(0).address4 txtName.Text = q(0).supplierName txtPhone.Text = q(0).phone txtFax.Text = q(0).fax txtPostCode.Text = q(0).postCode End Sub This causes a runtime error. The error is: "The query results cannot be enumerated more than once." and the txtAdd1.text line is highlighted. How am I supposed to get at the data so I can fill my text boxes this way? Thanks,
var query = from cloc in context.t_companylocs where (cloc.ref_company == companyid) && (cloc.street == attributes["Street"]) && (cloc.postalcode == attributes["Postalcode"]) && (cloc.country in countrylist) && (cloc.city in citylist) select cloc; attributes is a Dictionary<string, string> object.countrylist and citylist are List<string> objects.Of course the syntax above doesn't work. It's basically what I'm trying to achieve :-)A quick and dirty solution would be to just drop the two where constraints containing the "where in" statement and handle that part in the following foreach() loop.Can anyone please explain how you would do it properly?regards
Does anyone have a good example of how to insert data using System.Data.Linq? All the examples I've seen do something likeNorthwindDataContext db = new NorthwindDataContext();var x = new Product() {...}; db.Products.Add(x);db.SubmitChanges(); However I'm not seeing an Add method on System.Data.Linq.Table<T>. Has this changed? Could I somehow not be generating my model correctly?