.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Can't perform Create, Update or Delete operations on 'Table(outbox)' because it has no primary ke

Posted By:      Posted Date: August 27, 2010    Points: 0   Category :ASP.Net


I'm a beginner in asp.net and I have some problem inserting data into sql server 2005 with linq.


my code is : 


        Dim Result As New SMS.SendResult
        If Result.status = 0 Then
            Label1.Text = "Your Message Sent Successfuly"
            Dim db As New IGSSDataContext
            Dim out As New outbox With {.ClientID = intRandomNumber, .From = User.Identity.Name, .TO = TextBox1.TabIndex, _
            .Time = Now, .Message = Message}
            out.ID = (ID)
            TextBox1.Text = ""

View Complete Post

More Related Resource Links

LINQ - Can't perform Create, Update or Delete operations on because it has no primary key.

Hi, not sure if I'm posting this thread in the right section. anyway, I''m trying to do the update/insert/delete using LINQ but the underlying table does not a primary key. The table consists of composite ket (e.g. fieldA & FieldB make a primary key). At the moment, I have LINQ complaning about not having a single primary key (not sure what LINQ does it - not making any sense at all). did anyone ever come across this issue and rectified it?  thanks

How I can Create update Proc for Multipul Table by Id


How I can Create update Proc for Multipul  Table by Id . I will send the Table Name In parameter from my Vb.net Project which Table I need to Update. I am Giving the Sample in Below but it does not working

Help me regarding This Mattter

alter Proc Catagory_Update



@Table varchar (30),

@Name varchar (30),

@Id int





@sql nvarchar(MAX)


@sql = 'Update '+@Table+

'Set ([Name] = @Name)

where id = @id'


sp_executesql @SQL,N'@Name Varchar(30),@id int',@Name,@id



Update records related to primary table in sql


HI All,

For example

I have 2 tables  Person and Person_Child.

In Person table i have columns

Id, PersonId,PersonName,PersonAdrress,PersonAge,RowId


rowid is identity


and in the person_child table--here parentrowid refers to parent table rowid and again rowid is identity here

Id, PersonId,PersonName,PersonAdrress,PersonAge,ParentRowid,RowId




I need to update the child table values as it is in parent tables where it is null.

I have to do for many tables.

Is there any way to do it dynamically.







Save/Update/Delete Sql Server data base table using Sharepoint Designer


Can some one help me to achieve below task

Save/Update/Delete Sql Server data base table using Sharepoint Designer.

SSIS : Insert, Update, Delete records from destination table by comparing records in source table.


Requirement: Inse

rt, Update, Delete records from destination table by comparing records in source table.

Update: if records exist in both the table compare them, and update value in destination table if value is different.

Insert: if record doesn't exist in destination table, add new record in destination table.

Delete: if record exist in destination table but not in source table, delete record from destination table.

----> I have created an SSIS package that does all this task but in order to perform delete operation, I have to store all records of destination table into a temporary table.
And since it's not the most efficient way, I have created another SSIS package by using Lookup & conditional Splits
method, now it works fine with inserting and updating information but I am not sure on how to handle removing record operation!

I would really appreciate if you could help me with this.

(In order to archive inserting and deleting records, I have referred following thread!
http://sqlblog.com/blogs/andy_leonard/archive/2007/07/09/ssis-design-pattern-incremental-loads.aspx )

Help required regarding audit (Update/INSERT/DELETE) a table in Database.


Hi all


Help required regarding audit (Update/INSERT/DELETE) a table in Database.



I have table having with imp Data lets say ID, some of users are setting ID's to their own values with out informing us. I know it is not possible using Application what every my Database using.


Now I want find that who is doing this


Insert,Delete Update Operations with XML


i already bind my grid with xml file using dataset as dataset has property of reading xml

but now i want to perform operations on xml like Inserting of Data,Deleting of Data and Updating can anyone give me short tutoral how we can perform this thankx you

my xml

<?xml version="1.0" encoding="utf-8" ?>

Loading with Gridview

  private void loadxml()
        //throw new NotImplementedException();

How to Insert - Update - Create articles to tbl_Articles table by using FCKeditor ASP.Net MVC


I read many post about Intergrating Fckeditor to ASP.Net MVC, and I have done.

Now, I have tbl_Articles table, it contain some articles... How to Insert - Update - Create articles from TextArea of FCKeditor (ASP.Net MVC)

Please give some way for me. Thanks.

Design Data Contract for User Create/Update/Delete REST API using WCF 3.5 & JSON



I'm using REST with WCF .NET 3.5. I've design the class structure with below JSON struvture of input & output.

API 1: Create User: POST /id & request body is as shown below:

  "userList" :
       "name" : "<name>",
       "email" : "<email>",
       "dataId" : <dataId>,
       "country" : "<country code>",
       "name" : "<name>",
       "email" : "<email>",
       "dataId" : <dataId>,
       "country" : "<country code>",

The response object should be as shwon below:

  "userCreateResults" :
       "email" : "<email>",
       "userId" : <userId>,
       "password" : "<password>",
       "result" : <result code>
       "email" : "<email>",
       "userId" : <userId>,
       "password" : "<password>",
       "result" : <result code>

API 2: Update User: PUT /id & request body is as shwon below:

  "userList" :

Windows 7 Phone Database Rapid Repository Create Read Update and Delete


Download the code and a fully working example application from http://rapidrepository.codeplex.com/


  1. Introduction
  2. Set up the Rapid Repository
  3. Create, Read, Update and Delete
  4. Create partition on a table with difference in partition key and primary key


    Hi All,

    Can we create a partition on a table which is having primary key different and partition key different? Because in one of my table Id is primary key and I have to do a partition on date wise if possible how we can, I am new to partition

    Please find the below code which i was trying to create a partitions

    I have three different File groups [PRIMARY], FG2

    How to perform insert, update, delete and select rows in ASP.NET gridview control using stored proce

    In this article, we will explore how to add, update, delete and select a record from sql server database using gridview control in a simple way. I'm using visual studio 2010 and sql server 2008 for this sample.

    How to Perform SQL Server Row-by-Row Operations Without Cursors

    SQL cursors have been a curse to database programming for many years because of their poor performance. On the other hand, they are extremely useful because of their flexibility in allowing very detailed data manipulations at the row level. Using cursors against SQL Server tables can often be avoided by employing other methods, such as using derived tables, set-based queries, and temp tables

    SqlCommand.ExecuteNonQuery() returns -1 when doing Insert / Update / Delete

    Sometimes you end up with a return value of -1 when using the SqlClient.SqlCommand.ExecuteNonQuery method.

    Why is that?

    Well, the ExecuteNonQuery method is there for statements for changing data, ie. DELETE / UPDATE /INSERT, and the returned value are the number of rows affected by that statement.

    When checking the documentation we can see that there are some conditions that return -1.

    For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command.

    When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of

    rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1.

    Create new sql table at runtime VB.Net


    I want to create a new table to sql database at runtime.  The column names would be "Name", "Date", "Event".  I would also like to have one more column name "Image" but the problem is that since the amount of images will vary, I want the application to count the amount of files in the Multiple fileuploader and then add a image column to the table for the respected amount of files. 

    For example if i am uploading 3 files in the multiple fileuploader, the names should be "Name", "Date", "Event", "Image1", "image2", Image3"

    I also would like that table name to be name dynamically from the textbox Name when the user enters the information.

    I have the following code to make a new table, but I dont know how to name the fields at runtime like previously asked please help!!!

    Dim objConn As New SqlConnection("Server=<servername>;uid=<userid>;pwd=<password>;database=master")


    update/delete not working on server only


    my aspx page works in VWD, and everything works on the server EXCEPT update and delete sql functions. any ideas?


    Create/add table from code to database



    I create table:

                      DataSet data=new DataSet();

                      DataTable myTable = new DataTable("NewTable");

                       DataColumn[] keys = new DataColumn[1];

                       // create column
                       keys[0] = new DataColumn();
                       keys[0].DataType = System.Type.GetType("System.String");
                       keys[0].ColumnName = "PointID";
                       myTable.Columns.Add(keys[0]);    &nb

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend