DataSource Controls :: Can't Perform Create / Update Or Delete Operations

May 12, 2010

when i want insert a record i see an error like this

Can't perform Create, Update, or Delete operations on 'Table(MainMenuLink)' because it has no primary key.

with this codes:

MyLinqDataClassesDataContext db = new MyLinqDataClassesDataContext();
MainMenuLink li = new MainMenuLink { Link ="../error/error.aspx", LinkSubject = "subject" };
db.MainMenuLinks.InsertOnSubmit(li);
db.SubmitChanges();
ShowLinks();

what is the problem?

my table have a primary key but i dont know why give an error!!!

View 3 Replies


Similar Messages:

DataSource Controls :: Insert A Record Error - Can't Perform Create, Update, Or Delete Operations On 'Table?

May 11, 2010

when i want insert a record i see an error like this Can't perform Create, Update, or Delete operations on 'Table(MainMenuLink)' because it has no primary key. with this codes:

MyLinqDataClassesDataContext db = new MyLinqDataClassesDataContext();
MainMenuLink li = new MainMenuLink { Link = "www.tprogrammer.com", LinkSubject = "subject" };
db.MainMenuLinks.InsertOnSubmit(li); [code]....

View 2 Replies

Forms Data Controls :: GridView - Check Box Perform 2 Operations Simultaneously?

Apr 9, 2010

I have placed Chekc box in Gridview when i select the check box can perform 2 operations simultaniously one is entire recordset is populated into form fileds and second one is can delete the selected record permanently from database table.following code for this fuctionality.

GridviewCode
<asp:GridView ID="GVData" runat="server" Height="75px" Width="76px" CaptionAlign="Top"
Font-Size="Medium" EnableModelValidation="True" [code]....

View 3 Replies

DataSource Controls :: SQL UPDATE Command - Perform Math Function From Value

Jun 27, 2010

Is it possible to perform an update command which performs addition using a value from a textbox? For example: User inputs a number into TextBox1 (I use regular expression validation to ensure this is an integer).

[Code]....

Basically if the user inputs 5 into TextBox1, I want the update command to subtract 5 from that user's ballance.

View 2 Replies

How To Perform Same Operations On Both WebControls And HtmlControls.

Jan 19, 2010

I find myself needing to preform the same actions on both HtmlControls and WebControls. I am a firm believer in DRY and find the fact that there is only the Control class to use if I want to consolidate the functions on both types. The problem that I have with using Control is that there certain properties that both HtmlControl and WebControl expose that Control does not. In the current case, the Attributes property is the problem. how to avoid the duplication of code in this type of instance?

View 2 Replies

MVC :: To Perform Mathematical Operations Within A .aspx View?

Jan 14, 2011

Is it possible to perform mathematical operations within a .aspx View.? for example..lets say i have a total number of pencils of say 100. and i have 12 students on a data table with his or her name, and the number of pencils she has

Student Name: Pencil #

John 10

Sarah 12

Linus 19

But while rendering the view i want to calculate the Percentage of pencils one student possesses out of the total. (John would have 10% of the total 100 pencils)

How would i just perform this basic math operation, and encode the result into the view. I know i need to store the 100, and divide by each count of pencils for each student within the foreach loop. but i keep getting 0. This seems very elementary i know.. Help would be very appreciated. Google seems to have nothing for me.

View 3 Replies

Web Forms :: LINQ CRUD Operations - How To Perform Updation

Oct 21, 2015

How to do CRUD in LINQ?

how to perform updation using linq where i have multiple conditions for for single row and updating multiple fields to that row?

View 1 Replies

DataSource Controls :: Ckeck Sql Query Perform With Load By Using Tools For Create Load?

Feb 16, 2010

how to check performance of sql server query with load ,also wants to create load by any tolls like load runner,if any url for download load runner or any other tolls by which we can create load please give me some idea related to it.

View 1 Replies

DataSource Controls :: Tableadapter Configuration Wizard Cannot Generate The Delete&update Statement

May 4, 2010

in generate the Stored Procedures when using Create TableAdapter configuration Wizard in VS.it can not generate the Stored Procedures for Delete and Update Commands, but it generated for Select and Insert. i tried many times, but still get the same problem.

View 2 Replies

Forms Data Controls :: Datasource Update / Delete Queries For Gridview - Can't Edit

Dec 7, 2010

I have a gridview that pulls data from two tables, CLIENT and PAYMENT. I want to add the edit, delete functions to the gridview for the payment portion of the table, that is to edit or delete the payments but not the client. I've manually enabled the edit, delete functions and input the queries. I've also deleted the textboxes from the templates which draw from the CLIENT table so they cannot be edited. Everything looks good on the surface until I actually go to edit or delete anything, and it has no effect.Here's the structure of the two tables:

CLIENT PAYMENT
ClientID Pk PaymentNumber Pk
FName CLIENT$ClientID Fk
LName PaymentDate
ContactNo NULL PaymentAmount
ArrivalDate PaymentDetails NULL
DepartureDate NULL
CurrentResident

Here's the update query:

UPDATE [PAYMENT] SET [PaymentDate] = @PaymentDate, [PaymentAmount] = @PaymentAmount, [PaymentDetails] = @PaymentDetails WHERE [PaymentNumber] = @original_PaymentNumber AND [CLIENT$ClientID] = @original_CLIENT$ClientID AND [PaymentDate] = @original_PaymentDate
AND [PaymentAmount] = @original_PaymentAmount AND (([PaymentDetails] = @original_PaymentDetails) OR ([PaymentDetails] IS NULL AND @original_PaymentDetails IS NULL))

Finally, here's the delete query:

DELETE FROM [PAYMENT] WHERE [PaymentNumber] = @original_PaymentNumber AND [CLIENT$ClientID] = @original_CLIENT$ClientID AND [PaymentDate] = @original_PaymentDate AND [PaymentAmount] = @original_PaymentAmount AND (([PaymentDetails] = @original_PaymentDetails)
OR ([PaymentDetails] IS NULL AND @original_PaymentDetails IS NULL))

View 3 Replies

DataSource Controls :: ObjectDataSource / An Insert,select,Delete And Update Methods Being Referenced?

Jan 31, 2011

I am using an objectDataSource for the first time. My objectDatasource looks like this:

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="CustomerData"
DataObjectTypeName="Customer" DeleteMethod="DeleteCustomer" InsertMethod="InsertCustomer"
SelectMethod="GetCustomersByObject" UpdateMethod="UpdateCustomer" OldValuesParameterFormatString="original_

[code]...

View 1 Replies

DataSource Controls :: Create .net Service - Delete Specific Records From The Database?

Jun 1, 2010

i am trying to create an asp.net service where it can delete specific records from the databas, this is by code so far:

View 1 Replies

How To Create A Site To Insert/ Update / Delete

Nov 8, 2010

I just want to be able to create a site that will allow users to insert/update/delete information from the site and the information will be recorded on the SQL DB.

Went through couple of Videos and Tutorials, it can't be that complicated?

View 3 Replies

WCF / ASMX :: Create A Web Service Which Consists Of CRUD Operations Create?

Jan 20, 2011

i want to create a web service which consists of CRUD operations Create, Retrieve, Update and Delete. creating web methods on insert and update operations.

View 2 Replies

How To Update / Delete The Table Records In ASPNETDB.MDF In Single Update / Delete Query

Nov 29, 2010

I want to know how to Update / delete the table records in ASPNETDB.MDF in single update / delete query ?

View 1 Replies

Web Forms :: How To Programmatically Create / Update And Delete Site Map Nodes

Feb 2, 2010

How programmatically create, update and delete site-map nodes?

I use ASP.NET (VB.NET), Visual Studio 2010.

I try create own simple CMS for little site.

I need in admin area create, delete and update site-map nodes (and aspx pages with static text)

View 2 Replies

DataSource Controls :: Create Update Command In Code Behind?

Feb 3, 2011

I have a detailsview which I am populating using a SQLDATASOURCE, which is bound to a table in a SQL db. Because the number of columns in the table will change, I am using SELECT * from [TABLENAME] to populate the view, this works fine.

My problem is that I need to also be able to update the table and I thought the best way was to generate the updatecommand in the code behind. This is no problem, code is as follows:

[Code]....

But the next stage is to create the relevant parameters for the update command. Does anybody have any thoughts on this? All of the information I have found for the updateParamater reference knowing the final value.

What I really need to do is the code behind equivalent of

<asp:Parameter Name="PARAMETERNAME" Type="Int32" />

Not sure whether this is possible.

View 4 Replies

DataSource Controls :: Update / Insert And Delete SQL Statements For Define Custom Statements Wizard

Feb 23, 2011

I'm using the 'Configure Data Source' wizard to connect to my database and show the dataset in Gridview. I want to be able to update, insert and delete entries but am unsure how to build the query. I can write simple update statments to change database entries but how can I do this for entries that have been changed within the gridview?

View 6 Replies

DataSource Controls :: Create A Trigger To Update A Table In Informationdatabase?

Mar 19, 2010

I am trying to use SqlDependencyCache buthave come across a problem that I wouldn't have thought was unique. We have a InformationDatabase which uses a combination of its own tables and views to other databases on the same server. One of these views points to our HRDataWarehouse database. My stored procedure obviously uses this view to get its information but because the table change is happening on the HRDataWarehouse table the notification is not being sent to my app and as a consequence the cache is not removed.

Is there a tidy way of doing this or do I need to create a trigger to update a table in my informationdatabase and then have a listener on this with a removecache callback delegate added to the cache object?

View 4 Replies

Forms Data Controls :: Using A Gridview To Perform Bulk Update?

Feb 9, 2010

I have a gridview with checkboxlist for each record. I was updating each record individually based on that check, but now they want it to be a bulk update instead of individual. So i have commented out my individual update and added a button below the gridview and created my button event, how to loop thru the gridview and find the checked records and call my update procedure.

i found something kinda close to what i need, but its in VB and not sure how to convert that to C#

[URL]

View 2 Replies

Forms Data Controls :: Use The Gridview To Actually Perform An INSERTand Not A True Update?

Dec 15, 2010

if it's possible to use the Gridview (SQLDatasource) UpdateCommand to actually perform an INSERT and not a true update.Here's the dealUsing a Select statement in my SQLDatasource,I'm retrieving records for which there are no History records for a specified period.(Essentially, I'm asking "Show me all records for which there are no historical records within a specified range").I'm using that result set to feed my GridView. Basically, I'm displaying all I need to know about the insert records sans one piece of info.When the user choose the "Edit" button, the row goes into edit mode.Using a template field, I've created a drop down box to allow the user to input the status of the data for that particular time period.When they click the save button,the idea is that the UpdateCommand will fire.However, when I click the save button (in edit mode),I get a postback error that tells me System.Data.SqlClient.SqlException: Must declare the scalar variable "@EQP_PK".

[code]...

View 6 Replies

Forms Data Controls :: How To Perform Edit/Update And Cancel In The Grid View

Oct 23, 2010

how to perform Edit/Update & cancel in the grid view .. already the data is there in the gridview

[code]....

View 2 Replies

DataSource Controls :: Is It Possible To Perform A Query On A Datatable?

Feb 14, 2010

My web application calls a stored procedure and stores the result in a .NET datatable. I'd like to use this datatable and join it with other tables in my database. Is this possible?

Would the best way to set this up be to create another datatable and then use a dataview to join both datatables?

View 2 Replies

DataSource Controls :: Perform Sql Queries Onto Vb.net And Display Them?

Apr 26, 2010

I get from SQL Server Server Data. I need to use datas form 2 colums of my SQL query for a VB.NET. The VB.NET need 2 values for both colums and produce 1 answer. I what to display the value on the same line instead of the 2 1st values. How can i store the 2 colums wich lot of SQL values on my vb.net script and diplay the result with the other data from the SQL query ?

View 3 Replies

DataSource Controls :: Perform SUM On Results That Repeat?

Mar 2, 2010

I have the following query:

[Code]....

The results look like this:

DocumentNumber NIIN QtyReq AvailBalance
12345 015551212 2 5
12346 015551212 1 5
12347 015551212 3 5
12348 015554787 10 12

As you can see, the first 3 documents are for the same NIIN, and their total QtyReq is 6, however there are only 5 Available for this NIIN.

I need a way to remove the document 12346 because it cannot be filled, the other 2 document can though. I cannot figure this one out, but it seems like it should be pretty easy.I am using MS SQL Server 200

View 3 Replies







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