DataSource Controls :: Insert Dbnull With Linq To SQL?

Apr 28, 2010

I am trying to do an update and if no selection has been made in a dropdownlist (integer) or date field I would like to insert a dbnull value. But I am new to Linq to Sql and wonder if this is possible and if so how to process. I have the following code but the DBNull.Value is giving me an error.

Dim context As New SondageDataContext()
Dim repondant = (From r In context.Repondants Where r.RefRepondant = iRefRepondant Select r).Single
repondant.Prenom = strPrenom
repondant.Nom = strNom
If dtAdhesion > Date.MinValue Then
repondant.DateAdhesion = dtAdhesion
repondant.DateAdhesion = DBNull.Value
End If
'Integer for dropdownmenu
If iOccupation <> -1 Then
repondant.RefOccupation = iOccupation
repondant.RefOccupation = DBNull.Value
End If

View 8 Replies

Similar Messages:

DataSource Controls :: Insert DBNull Value Into Varchar 1 Null Field

Aug 12, 2010

My database includes a table with sever filds which are defined as (varchar(1),null), I tried using DBNull.Value, null, ' ' but cannot get a null inserted in that field of the database,


View 4 Replies

DataSource Controls :: How To Get The ID Of The Record I Just Insert In LINQ To SQL

May 25, 2010

I use the following code to insert recode to a sql 2008 table, the field ID of DBProgram is IDENTITY, so SQL 2008 SERVER will pass a value to it automatically. How can I get the ID value of the record I just insert ?

DBProgram dbProgram = new DBProgram();

View 1 Replies

DataSource Controls :: Using IF Statements In LINQ Insert Query?

Jun 7, 2010

I tried to find a LINQ section on this forum, but couldn't, so I'll post this here since is deals with LINQ, C#, MVC, SQL Server, and well...just about everything.

Here's the details....My Application is an ASP .Net MVC 1.0 app, using C# 3.5, SQL Server 2005 Std, and LINQ to Entity.

In my View, I have numerous Html.CheckBox controls, they get passed to my Controller as a string collection via a JQuery Ajax call. The values of each checkbox are seperated by a comma(,). I then Split the string, to get the individual values. The overall purpose to to allow users to build a custom report with only the data elements they have checked the boxes for. Here is my controller:


The part that I am having a problem with is that I only want to Insert the data elements into my DB table for the ones that the user has selected the checkbox for. So, for example, I'd like to do something like this:


I don't know if there is a LINQ switch statement in which I can access outside variables and the columns of the table, or any thing like that.

View 1 Replies

DataSource Controls :: LINQ / Insert Records Without Having Primary Key?

Apr 29, 2010

I am using LINQ Expression to insert records in SQL Table. My Table dosen's have any Primary Key Field. Whenever I Am trying to Insert Records in Table using LINQ Expression, this always occurs an Error that 'the Table You are using to insert Dosen't Have Any Primary Key Field.

How I Will Insert Records Without Having Primary Key ?

View 1 Replies

DataSource Controls :: Insert Master Detail From Text File With LINQ

Mar 2, 2010

I'm new onto LINQ and im working on a application which uploads a requisition from a preformated text file that is coming from another application.

Th format of the file its like:

HDR 001000 Description

DTL PartNumber CatalogNumber ItemDescription RequestedQty RequiredDate

DTL PartNumber CatalogNumber ItemDescription RequestedQty RequiredDate

DTL PartNumber CatalogNumber ItemDescription RequestedQty RequiredDate

I want to insert information gathered from the text file readed using streamreader with master/detail using LINQ datacontext into the database.

Heres the code of a test page to loop through the file:


View 5 Replies

DataSource Controls :: Object Can Not Be Cast From Dbnull To The Other Types?

May 24, 2010

I have a webpage, i have a usercontrol in it , its name ispersonal1, i have tow Radiobutton in this usercontrol, the id of one of them ismale and the other one is female, it is obviously that each time we fill one of these radiobuttons and the other one will be null,in my database the type of these fields are bit , and they have allow null, i defined a property for my usercontrol like this:

public bool male


View 2 Replies

DataSource Controls :: DBNull Error Trying To Call Stored Proc?

Jan 7, 2011

I have a recordset in a gridview that comes from an outer joint that creates null values in the recordsetWhen I write to the database using stored proc defined in datasource I get dbnull error.I'm trying to process the onDeleting event in the code behind but don't know what to write or if that's the best wayI need to call a stored proc and if the last parameters value is null then the stored proc does one thing, if it's no null it does something else.However DBNull doesn't ssem to be working.

View 1 Replies

DataSource Controls :: Select A Record From A Table And Insert Into B Table Using Linq?

Jun 29, 2010

how can i select a record from A table and insert into B table using linq?

View 2 Replies

DataSource Controls :: Insert A "Select User" Row In Linq For A Dropdown List?

Sep 7, 2010

I'm new to Linq. I have searched and searched the web for a soluion, and can't find anything. I have a Linq query and I want to insert a row ("Select User") to the top before I pass it to the drop down list. I've been trying to use the Union but to now avail (it keeps telling me that my object doesn't support the Union method). My code, prior to attempting to inser a row, is very simple.

public SelectList DropDown_Users()
var context = new VivarianDataContext();
var query = from t in context.AspnetUsers
select new { t.UserId, t.LastName };
list = new SelectList(query.AsEnumerable(), "UserId", "LastName");
return list;

Now I try to insert a row and I found this on the internet and it seems to say that his solution will work. But it is filled with syntax errors. [URL]

I tried to implement it using the following code, but it doesn't compile.

public SelectList DropDown_Users()
SelectList list;
//get the original data
var context = new SQL2005633131VivarianDataContext();
var query = from t in context.AspnetUsers
select new { t.UserId, t.LastName };
//create a dummy table with an empty row
var AllUsers = new List<AspnetUsers>();
var BlankUser = new AspnetUsers()
{UserId=System.Guid.Empty, LastName="Select One"};
//use Union to join the data - ERRORS HERE
var newTable = AllUsers.Union(query);
list = new SelectList(newTable.AsEnumerable(), "UserId", "LastName");
return list;

View 7 Replies

DataSource Controls :: 'Conversion From Type 'DBNull' To Type 'String' Is Not Valid.'

Feb 17, 2010

I'm trying to get a value from a database and I'm getting an error, see code below:


I get and error when I'm trying to convert the value out of the stored procedure to the string SNAME. Error is as follows:

'Conversion from type 'DBNull' to type 'String' is not valid.'

and the stored procedure is as follows:


View 6 Replies

DataSource Controls :: Conversion From Type 'DBNull' To Type 'Integer' Is Not Valid?

Jan 22, 2010

I get the error - Conversion from type 'DBNull' to type 'Integer' is not valid. - on the line.....

Dim newid As Integer = e.Command.Parameters("@latestRowId") vb code behind.

I have the identical code for another page with the exception of the field names and it works fine. The only thing I did differently, as far as I know, is I copied the asp and code behind from the page that works into this page and manually changed the field and table names. I don't know what the problem is. Does anyone see any problems?


View 2 Replies

DataSource Controls :: Set Field As DBNull.Value If Field Is Blank?

Apr 7, 2010

I have a 20 to 30 fields on a form. Most of them are optional. However, the users can fill out what they want. If a user dosen't fill in a field when data is sent to the database it's sent as blank, instead of NULL. Is there a way I can generically say "for all textboxes if Equals("") then DBNull.Value". Without going through each and every textbox?

View 2 Replies

DataSource Controls :: Linq To SQL Set Linq Object Propertychanged?

Mar 12, 2010

I am writing a plugin to help with a current ERP system we have that I am not allowed to modify the data structure at all. The table I am dealing with has over 100 columns and I am wanting to set my linq object propertychanged event and submitchanges or do I really have list out each property and set it equal to the new one?Below is an example of what I am trying to do:


View 4 Replies

DataSource Controls :: LINQ To DataSet And LINQ To Object

Mar 9, 2010

txtLastName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Last_Name.ToString();

Like that I have large number of controls on my form. I have dought, if I assigned like this, db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Last_Name.ToString(); to every control, then I have set of controls like,

ddlSalutation.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Salutation.ToString();
txtLastName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Last_Name.ToString();
txtFirstName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).First_Name.ToString();
txtMI.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Middle_Initial.ToString();
txtAddress.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Home_Address.ToString();
txtCity.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).City.ToString();
ddlState.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).State.ToString();
txtZip.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Zip_Code.ToString();
txtSSNo.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ssn.ToString();
txtMRNo.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Mr_No.ToString();
txtDOB.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Birth_Date.ToString();
RBGender.SelectedItem.Value = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Gender.ToString();
RBMaritalStatus.SelectedItem.Value = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Marital_Status.ToString();
txtHomePhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Home_Phone.ToString();
txtWorkPhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).WorkPhone.ToString();
txtCellPhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).CellPhone.ToString();
ddlSuffix.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Suffix.ToString();
txtReligion.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Religion.ToString();
txtEmail.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Email.ToString();
txtSSOName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ssn.ToString();
txtPatientKin.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Patient_Kin.ToString();
txtRelationWithPatient.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Kin_Relation.ToString();
txtPhoneNo.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Kin_Phone.ToString();
ddlPreferredPharmacy.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Id_Pharmacy.ToString();
txtEmergencyContactName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Emergency_Contact_Name.ToString();
txtEmergencyContactNumber.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Emergency_Contact_Phone.ToString();
txtRelation.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Kin_Relation.ToString();
txtRace.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Race.ToString();
ddlHowDidPatientFindUs.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).How_Found.ToString();
txtEmployerName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Employer_Name.ToString();
txtEmployerOccupation.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Employer_Occupation.ToString();
txtEmployerPhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Employer_Cell_Phone.ToString();
txtEmployerAddress.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Employer_Address.ToString();
txtEmployerCity.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Employer_City.ToString();
ddlEmployerState.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Employer_State.ToString();
txtEmployerZip.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Employer_Zip.ToString();
txtRecordsReleasedTo.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Records_Released_To.ToString();
txtOtherInfo.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Other_Info.ToString();
txtPopupNote.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Popup_e.ToString();
ddlPPlanName.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Insurance_Name.ToString();
txtPGroupNo.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Group_No.ToString();
txtPIDNo.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Id_No.ToString();
txtPPhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Plan_Phone.ToString();
txtPVerifiedWith.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Verified_With.ToString();
txtPVerifiedPhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Verified_Phone.ToString();
txtPEffectiveDate.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Effective_Date.ToString();
txtPExtDate.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Ext_Date.ToString();
if (db.usp_ATI_FetchPatientDetails(iPatientID).Count() > 0)
txtPGLastName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_Name.ToString();
txtPGFirstName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_Name.ToString();
txtPGMI.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_MI.ToString();
txtPGBirthGDate.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_Dob.ToString();
txtPGAddress.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_Address.ToString();
txtPGCity.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_City.ToString();
ddlPGState.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_State.ToString();
txtPGZip.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_Zip.ToString();
txtPGEmployerFirstName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_Fname.ToString();
txtPGEmployerLastName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_Lname.ToString();
txtPGEmployerPhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_Phone.ToString();
txtPGEmployerOccupation.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_Occupation.ToString();
txtPGEmployerAddress.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_Address.ToString();
txtPGEmployerCity.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_City.ToString();
ddlPGState.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_State.ToString();
txtPGEmployerZip.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Grn_Emp_Zip.ToString();
ddlPGPatientRelationshipToGuarantor.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Grn_Rel_With_Pat.ToString();
txtPGOtherInsuranceNotes.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Other_Notes.ToString();
txtPGAuthorization.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_Authorization.ToString();
txtPGAob.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(0).Ins_AOB.ToString();
if (db.usp_ATI_FetchPatientDetails(iPatientID).Count() > 1)
txtSGLastName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_Name.ToString();
txtSGFirstName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_Name.ToString();
txtSGMI.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_MI.ToString();
txtSGBirthGDate.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_Dob.ToString();
txtSGAddress.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_Address.ToString();
txtSGCity.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_City.ToString();
ddlSGState.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_State.ToString();
txtSGZip.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_Zip.ToString();
txtSGEmployerFirstName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_Fname.ToString();
txtSGEmployerLastName.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_Lname.ToString();
txtSGEmployerPhone.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_Phone.ToString();
txtSGEmployerOccupation.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_Occupation.ToString();
txtSGEmployerAddress.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_Address.ToString();
txtSGEmployerCity.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_City.ToString();
ddlSGState.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_State.ToString();
txtSGEmployerZip.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Grn_Emp_Zip.ToString();
ddlSGPatientRelationshipToGuarantor.SelectedItem.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Grn_Rel_With_Pat.ToString();
txtSGOtherInsuranceNotes.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Other_Notes.ToString();
txtSGAuthorization.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_Authorization.ToString();
txtSGAob.Text = db.usp_ATI_FetchPatientDetails(iPatientID).ElementAt(1).Ins_AOB.ToString();

My question is that, for each control the Stored Procedure called or not? If it is yes then it is time consuming and I need to use LINQ to DataSet or LINQ to Object rather than to call SP for each control. What is difference between LINQ to DataSet and LINQ to Object?

View 5 Replies

DataSource Controls :: Pass In As An Insert Parameter For SQLds2 The Scope_identity Of The Insert Of SQLds1

Jan 12, 2010

I am trying to pass in as an insert parameter for SQLds2 the scope_identity of the insert of SQLds1.

Exception Details: System.InvalidOperationException: Error executing 'InsertCommand' in SqlDataSource 'SqlDataSource1'. Ensure the command accepts the following parameters: @Name1, @NewId


View 4 Replies

DataSource Controls :: Insert In To 2 Tables Using A SQL And Details View Insert Functionality?

Aug 12, 2010

I do have a details view, which insert data to a database table using SQL Datasource. Now i need the data to be inserted in to 2 tables instead of one.

View 1 Replies

DataSource Controls :: Sql Insert Failing On Detailsview Insert Or Update?

Mar 6, 2010

I am using 1 textbox with a Ajax Calendar extender to allow my user's to select a date graphically (exp: 12/15/2009). I have another textbox for the hour and minutes in military time(exp: 15:30). I think i have the code to grab the data from the 2 textbox's and combine them to be inserted into the field (exp: 12/15/2009 15:30). Here is my insert code for the Field:


However unless I make all the fields Nullable the insert fails, on top of that none of the other field that I have selected on the Detailsview Insert or Edit are inserted into there fields. Half of my fields have to be non-null values. So how do I fix this?

I can supply additional vb code and the aspx code if needed.

This is the error I'm getting: Cannot insert the value NULL into column 'Operation_type', table '/GAOSDB.MDF.dbo.BC_Perf_Log'; column does not allow nulls. INSERT fails. The statement has been terminated.'

This is the first non-null column.

I need to get this figured out because I have 30 other web pages that will be utilizing the same approach.

View 4 Replies

DataSource Controls :: Insert A New Record, Then Using That New Records PK ID In Another Insert

Jun 30, 2010

Conseptually what I'm doing is simple, and technically it may even be simple, but I'm still rusty. Here's what I'm trying to do:

I have a webform that allows the user to enter a new record, and in there I have also included a couple FileUpload controls. Upon clicking the "Save" button, I'm saving the details entered into one table (ITEMS), and also inserting the FileUpload details (path, id, upload_user) into another table ATTACHMNTS). Because one ITEM can have many attachments, I needed to split the tables up. So on save, I need to save the ITEM, save the ATTACHMENT, and then also put the ITEM_ID in the ATTACHMENT table. I'm second guessing myself because I think all I'd have to do is after I do the ITEM insert, do a SELECT MAX on the ITEM table and hold the newest (MAX) id in a variable and then use it in the ATTACHMENTS update. I'm not 100% on this because there IS a chance that someone else could save a few milliseconds later and I'll link the wrong ITEM. See my delima?

View 7 Replies

DataSource Controls :: INSERT Statement For A CSV To Insert Into SQL Express?

Dec 15, 2010

I have a project that I was using Access for but now find I have to change to SQL Express. Well I have no big problem with that but I now find that the SQL Statement I have been using was for OLE and does not work in SQL/Express. I am not even sure anymore if I can dump the entire CSV file in at one time? The statement I was using is below.


Here is my problem. What is the INSERT statement to insert a complete flat (CSV) into SQL Express? OR what method can I use to preform this task?

View 2 Replies

DataSource Controls :: Unable To Cast Object Of Type 'System.DBNull' To Type 'System.String'

May 28, 2010

I am trying to write a table output from SQL database to a gridview/ Data List through an Object Data Source. I am a new starter and your help will be useful.

public List<Staff> GetStaff()
cmd.CommandType =
SqlConnection con =
SqlConnection(connectionstring);SqlCommand cmd =

View 4 Replies

DataSource Controls :: Compile In Order To Get The System.Linq.Dynamic Namespace / Dynamic Linq Error

Apr 20, 2010

I've added the Dynamic.cs file to my project and have set it's Build Action = Compile in order to get the System.Linq.Dynamic namespace.

However, when I try to use any of the new code I am getting an ambiguous call error; see below.


View 2 Replies

DataSource Controls :: Sqldatasource Insert Method - Copy Data To The Other Datasource By Selecting Checkbox

Feb 25, 2010

i have two sqldatasource controls. one i use to display data in textbox's ,filter'd by a select parameter in page behind code. Once checked, i want to copy this data to the other datasource ,by selecting checkbox.Then display this data in detailsview control.

At present the two datasource controls declared , render data to the page simultaneously during pageload. I want to first check data in textbox's from first source, before second datasource is rendered to screen. note, both are filtered by a page variable. i wish to leave the textbox datasource control in situ, as other controls and code depend on it.The other detailsview datasource is my problem?

View 1 Replies

DataSource Controls :: Using LINQ Datasource Control To SQL Databind

Feb 18, 2010

I have got an issue while using LINQ 2 SQL.

public IEnumerable<Customer> GetCustomers()
Table<Customer> custObject = context.Customers;
IEnumerable<Customer> filteredCustList = from customer in custObject
select customer;
GridView2.DataSource = utilLinqClass.GetCustomers();

(no errors at build time or at compile time) Error I am getting is: An attempt to attach an auto-named database for file App_Dataaspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

View 1 Replies

DataSource Controls :: SQL Insert Using DataSource?

Aug 25, 2010

having trouble with this code:

= New
Data.DbType.AnsiString, "test")
= New
Data.DbType.AnsiString, "test")


View 3 Replies

Copyrights 2005-15, All rights reserved