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? 
 

View 1 Replies


ADVERTISEMENT

Performance Of SPROC Changed By Dbo. Prefix

Feb 19, 2007

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

View 6 Replies View Related

SQLDataSource Cntrl - FormView Cntrl - UPD Sproc And Sproc Debugger. I Dare Anyone To Figure This One Out.

Feb 13, 2007

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?
 
Thanks,
SMA49

View 3 Replies View Related

Could Not Recognize New Keyword In 2005

Jan 4, 2007

JANAKIRAM writes "Hi,

I am using SQL Server 2005 & Windows XP O/s with SP6.

My SQL Server could not recognize the all new SQL Keywords & Methods incorporated into 2005.
It's givng Incorrect Syntax error.

Why so. What am I missing to cinfigure before using them.

Please let me know.

Thanks & Regards
Janakiram"

View 6 Replies View Related

System Won't Recognize Sql Server

Apr 7, 2006

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.

View 1 Replies View Related

Recognize NULL Values As Being Equal...

May 1, 2001

Hi,

I'm using SQL SERVER 7.0.


I'm driving myself crazy on this one. I have 2 tables that look like this:


T1T2
C1C2C3C1C2C3
JOE1OTTAWAJOE1TORONTO
MARC1OTTAWAMARC4OTTAWA
GAVINNULLHALIFAXGAVIN3HALIFAX
DARRINNULLHALIFAXDARRIN3HALIFAX
DENISENULLPITTSBURGHDENISENULLPITTSBURGH
LOUISENULLRUSSELLLOUISE2RUSSELL
ANDREA3STITTSVILLEANDREANULLSTITTSVILLE
MARIO66PITTSBURGHGEORGE6KINCARDINE
LARRY6KINCARDINE
MARIO66PITTSBURGH

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:

JOE1TORONTO
MARC4OTTAWA
GAVIN3HALIFAX
DARRIN3HALIFAX
LOUISE2RUSSELL
ANDREANULLSTITTSVILLE
GEORGE6KINCARDINE
LARRY6KINCARDINE


I've included a script to build and populate the tables below.

Any help on this will be greatly appreciated.

Thanks in advance,
Darrin

------------------------------------------------
IF EXISTS(
SELECT*
FROMSYSOBJECTS
WHERENAME = 'T1'
)
DROP TABLE T1
GO

IF EXISTS(
SELECT*
FROMSYSOBJECTS
WHERENAME = 'T2'
)
DROP TABLE T2
GO


CREATE TABLE [dbo].[T1] (
[C1] [varchar] (50) NULL ,
[C2] [varchar] (50) NULL ,
[C3] [varchar] (50) NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[T2] (
[C1] [varchar] (50) NULL ,
[C2] [varchar] (50) NULL ,
[C3] [varchar] (50) NULL
) ON [PRIMARY]
GO


INSERT T1 VALUES('JOE', '1', 'OTTAWA')
INSERT T1 VALUES('MARC', '1', 'OTTAWA')
INSERT T1 VALUES('GAVIN', NULL, 'HALIFAX')
INSERT T1 VALUES('DARRIN', NULL, 'HALIFAX')
INSERT T1 VALUES('DENISE', NULL, 'PITTSBURGH')
INSERT T1 VALUES('LOUISE', NULL, 'RUSSELL')
INSERT T1 VALUES('ANDREA', '3', 'STITTSVILLE')
INSERT T1 VALUES('MARIO', '66', 'PITTSBURGH')
GO


INSERT T2 VALUES('JOE', '1', 'TORONTO')
INSERT T2 VALUES('MARC', '4', 'OTTAWA')
INSERT T2 VALUES('GAVIN', '3', 'HALIFAX')
INSERT T2 VALUES('DARRIN', '3', 'HALIFAX')
INSERT T2 VALUES('DENISE', NULL, 'PITTSBURGH')
INSERT T2 VALUES('LOUISE', '2', 'RUSSELL')
INSERT T2 VALUES('ANDREA', NULL, 'STITTSVILLE')
INSERT T2 VALUES('GEORGE', NULL, 'KINCARDINE')
INSERT T2 VALUES('LARRY', NULL, 'KINCARDINE')
INSERT T2 VALUES('MARIO', '66', 'PITTSBURGH')
GO

View 3 Replies View Related

HELP: Renamed Machine Now SQL SRVR 7 Won&#39;t Recognize

Sep 19, 2000

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?

View 2 Replies View Related

SQL 2000 Fails To Recognize 2nd Processor

Jul 20, 2005

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

View 2 Replies View Related

SSIS Does Not Recognize CRLF As The En Of Line

Jul 14, 2006

Hi all,

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.

Sample:

CSV file:
Col 1;Col 2;Col 3;Col 4;Col 5
AAAA;BBB;CCC;;
AAA1;BBB1;CCC1;;
AAA2;BBB2;CCC2
AAA3;BBB3;CCC3

Imported rows in SSIS:
Col 1 Col 2 Col 3 Col 4 Col 5
AAAA BBB CCC
AAA1 BBB1 CCC1
AAA2 BBB2 CCC2 AAA3 BBB3;CCC3

Any idea ?

Sébastien

View 8 Replies View Related

DTS Doesn't Recognize CRLF In Text File

Sep 26, 2005

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 ?

Thanks

Greg

View 1 Replies View Related

EXEC Of A Sproc Within Another Sproc

Apr 23, 2004

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

EXEC @OldCategoryID = BP_GetLedgerCategory @EntryLogID

UPDATE
BP_EntryLog
SET
ProjectID = @ProjectID,
CategoryID = @NewCategoryID,
Expended = @Expended

WHERE
EntryLogID = @EntryLogID

EXEC BP_UpdateCategories @ProjectID, @NewCategoryID, @Expended, @OldCategoryID



Called Sprocs:

*********************************************
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

View 2 Replies View Related

Exec Sproc In Sproc

Jan 20, 2004

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??

Tks

View 2 Replies View Related

SQL Server 2008 :: How To Recognize And Start A Job If Another Job Step Is Successful

Jun 1, 2015

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.

View 3 Replies View Related

Report Manager On 64 Bit Machine Does Not Recognize 32 Bit Data Sources

Aug 22, 2007

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.

Thanks

































View 2 Replies View Related

Parent Package Doesn't Recognize Child Settings

Oct 27, 2006

I have two issues:

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??

Anyone else experience this?

thx

View 1 Replies View Related

SQL Server Doesn't Recognize Local F G Drive Problem

May 8, 2008

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

View 1 Replies View Related

SSIS Import Wizard Does Not Recognize The Excel Format

Sep 6, 2007

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.


<html xmlns="urnchemas-microsoft-comfficeffice"
xmlns:x="urnchemas-microsoft-comffice:excel"
xmlns="http://www.w3.org/TR/REC-html40">

<head>.................

I also used OPENQUERY to see if it works.


SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',

'Excel 12.0 xml;HDR=Yes;Database=C:myexcelfile.xls', 'SELECT * FROM [Table1$]');


SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',

'Excel 8.0;Database=C:datamyexcelfile.xls', 'SELECT * FROM [Table1$]')

I get the following errors.

OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "External table is not in the expected format.".

Msg 7303, Level 16, State 1, Line 1

Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".

Msg 7399, Level 16, State 1, Line 1

The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" reported an error. The provider did not give any information about the error.

Msg 7303, Level 16, State 1, Line 1

Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".

When I open the file and save it to overwrite the existing .xls file it works fine.

Is there a way to import such files using SSIS without having to open and save it?

Thanks in advance!

Tkaram

View 25 Replies View Related

SQL Server 2014 :: Unable To Recognize Table Name Or Field Names

Jul 8, 2014

I have created a table name "tblPopulation" with fields 'Country', 'State' etc....

When i query it with table name as tblpopulation with fields 'country', 'state' then i get error as invalid object name.

View 9 Replies View Related

SSIS Import Of CSV Don't Recognize NULL Values For VARCHAR Fields

Sep 4, 2007

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.

did anyone else had this problem?

thanks so much for any help.

View 4 Replies View Related

SQL Server Management Studio Express Doesn't Recognize .mdf File

Feb 25, 2008



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.

Thanks,
Leesha

View 3 Replies View Related

Reporting Services :: Server Did Not Recognize Value Of HTTP Header SOAP Action

Jun 29, 2015

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.

View 3 Replies View Related

Power Pivot :: List Separator Not Properly Recognize Semi-colon Instead Of Comma

May 19, 2015

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.

View 2 Replies View Related

Max With LINQ

Jan 8, 2008

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!   

View 2 Replies View Related

LINQ - What Do You THINK?

Nov 2, 2007

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�.

View 18 Replies View Related

LINQ To SQL

Apr 20, 2008

Is it possible to use LINQ to SQL with Report Services? If so, are there any examples, tutorials, etc.?

View 1 Replies View Related

Linq To Sql

May 28, 2008

Is Linq a feature of sql server 2008 ?
Or is it a feature of DOt net. Visual Studio 2008 ?

View 1 Replies View Related

Linq To Sql

May 28, 2008

Some say linq to sql leads to the death of stored procedures is it correct ?

View 4 Replies View Related

Linq + Sql Server Everywhere = ?

Nov 8, 2006

Will Linq be compatible with Sql Server Everywhere without having to add additional plugins?

View 7 Replies View Related

LINQ To SQL Question ?

Dec 30, 2007

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;
 
/// <summary>
/// Summary description for FILE_MASTER_INSERT
/// </summary>
//namespace Linq2Sql_demo_doc
//{
   
    [System.Data.Linq.Mapping.Table(Name = "FILE_MASTER")]
 
    public partial class FILE_MASTER
    {
 
    string Tablename;
        public FILE_MASTER()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        [System.Data.Linq.Mapping.Column(Name="filename")]
        public string FileName
        {
            get;
 
            set;
 
           
        }
 
        [System.Data.Linq.Mapping.Column(Name = "file_content")]
        public byte[] file_content
        {
            get;
 
            set;
 
 
        }
 
        [System.Data.Linq.Mapping.Column(Name = "file_id", IsPrimaryKey = true, IsDbGenerated = true, CanBeNull = false)]
       
        public int file_id
        {
            get;
            set;
 
        }
 
    }
 
    public class TestDB : DataContext
    {
 
        public Table<FILE_MASTER> FILE_MASTERs;
 
       //Initializing base class constructor
 
        public TestDB(string s) : base(s) { }
               
    }
 
 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?
 
 
                  Thank you. Jeyaseelan  

View 1 Replies View Related

When IDENTITY_INSERT Is Set To OFF. -- LINQ

Jan 21, 2008

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();

newUser.username = txtUsername.Text;
newUser.email = txtEmail.Text;

//Add the user to the User table.
db.Users.InsertOnSubmit(newUser);
db.SubmitChanges();
}
else
{
Label1.Text = txtEmail.Text + " already exists in the database.";

 

View 6 Replies View Related

Linq ISingleResult

Jan 27, 2008

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,

View 5 Replies View Related

How To Do Where In Select In Linq?

Mar 7, 2008

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 

View 1 Replies View Related

Linq To Sql -- Inserting

Mar 12, 2008

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?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved