DataSource Controls :: Get EmpId Of Related CurrentUserId ,and Want To Add EmpId In Other Table Having FK,using Repository?

Mar 30, 2010

I have- empId - PK, CurrentUserId in one table,mpId- FK in other table.now i want to get empId of related currentUserId ,and want to add empId in other table having FK,using Repository,what will be in create method?

View 4 Replies


Similar Messages:

Web Forms :: A Field Or Property With Name EmpID Was Not Found On Selected Data Source

Apr 9, 2012

I am using two gridviews with one datasourse. I am getting one error 

A field or property with the name 'Empid' was not found on the selected data source. Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: A field or property with the name 'Empid' was not found on the selected data source. Source Error: 

My code is   

<asp:GridViewid="gridview"
runat="server" DataSourceID = "SqlDataSource1"
PageSize="30" EmptyDataText = "No Records Found" EmptyDataRowStyle-HorizontalAlign ="Center"
AllowPaging="true"

[Code]....

View 1 Replies

DataSource Controls :: Get Record Count With Related Table?

May 17, 2010

I want to get record count from below example.

I made two tables. One is club_info and another one is club_members.

And each table has data like following

[club_info]
club_id
club_name
:
[club_members]
mem_id
club_id
:

I want to get club_name and the member count for selected club_id and want to return the result as sqldatareader.

View 8 Replies

DataSource Controls :: Batch Update A Dataset Table Which Data Are From Related Tables?

Jun 8, 2010

My dataset table data is from multiple tables (showing on a gridview),How to update the database tables using batch udpate on clicking submit, if the data is from a signle table, no problem, but I am not sure how to handle if the datais from mulitiple tables? If I have related tables, do I need put them in differet tables in the dataset?

View 6 Replies

DataSource Controls :: Search Repository And Ensuring Results?

Jun 1, 2010

I was trying to find out how to search a repository and ensuring the results returned are only for the items in the repository which match the search text. For example:

[Code]....

Where i have "where s.SupportIssueID.... I want only the results which have an ID that matches or is LIKE the given "searchText". I thought I could use s.SupportIssueID.Contains but this isnt available in the helpers.

View 2 Replies

DataSource Controls :: Data Access Repository NO LINQ?

May 18, 2010

I am new to MVC and this really probably should not be posted here but in a different forum topic. The reason I am posting here though is I am not sure if there is something about MVC that would prevent me from doing what I am looking to do.So here it goes.Maybe I am the only one out there that thinks this way but I don't care for and don't fully understand LINQ. I Like building my stored procedures passing my data to a datareader etc... and displaying what I need.

Now that being said I am wanting to learn how to make a true Data Repository and build from there but everything I find online especially here all gives me examples and instructions on how to do so using LINQ.Does anyone know of a site that will teach me how to do this without using LINQ or any form of ORM just allow me to write my stored procs how they need to be and build my classes for data access how they need to be.I may be wrong in this but it seems to me this would be the more light weight way of doing it.Anyhow as stated above the additional question to this would be is there any reason this would not work for MVC and actually any reason it is extremely (or at least for me) hard to find any documentation on this anywhere online?

View 3 Replies

Trying To Create A Repository Class For Each Table

Dec 17, 2010

I am trying to create a repository class for each table. For example I have TableA, TableB and TableC. TableB and TableC has Foreign key to TableA. I created an interface for TableA, TableB and TableC with SaveData() and ListData(). I have MVC form which inserts the data into these tables. When implementing these interface methods do I have to create a seperate class for each interface? Please let me if I am doing right.

[code]....

View 2 Replies

DataSource Controls :: Inserting Related Entities?

Mar 5, 2010

Inserting Related Entities?

View 14 Replies

DataSource Controls :: Sql Server Network Related Error?

Jun 2, 2010

I have the folloing sql server error from my ASP.NET website.

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

This seems to be a network related issue. But on the same machine where IIS is running, I have another C# application running that is not experiencing this problem. This happens after the website has been running for a few weeks. Will this be because the database connections are opened but not closed properly?. I wrote a test web page where i just open connection but not close it and I got Time out error when connection pooling is maxed out. Is this memory issue? Memory that are allocated are not deallocated in timely fashion?..

Everything is working fine for a few weeks and after that I get the above network error.

View 2 Replies

DataSource Controls :: EntityDataSource With Include For Related Columns

Feb 28, 2011

I have a formview with an entityDataSource. I need to include columns from related fields. I have seen many demos, with AdventureWorksDB, that imply that you can do this by using INCLUDE in the entitydatasource declaration. I have tried made many attempts and it just does not seem to work as demonstrated. I have attached the errors below and the EDS. I have also attached a JPEG of the model I am working in. Three errors demonstrating 3 different attempts to include a related table:

DataBinding: 'TmModel.tbICObjectBase' does not contain a property with the name 'Group'
the code declaration for error 1:
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Group") %>' />
DataBinding: 'TmModel.tbICObjectBase' does not contain a property with the name 'tbICTagBase'.
the code declaration for error 2:
<asp:Label ID="Label1" runat="server" Text='<%# Bind("tbICTagBase.Group") %>' />
DataBinding: 'System.Data.Objects.DataClasses.EntityCollection`1[[TmModel.tbICTagBase, TmModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' does not contain a property with the name 'Group'.
the code declaration for error 3:
<asp:Label ID="tbICTagBasesLabel" runat="server" Text='<%# Bind("tbICTagBases.Group") %>' />
EntityDataSource
<asp:EntityDataSource ID="entDSObjectBase" runat="server" AutoGenerateWhereClause="True"
ConnectionString="name=IntouchDBContainer" Include="tbICTagBases"
DefaultContainerName="IntouchDBContainer" EnableFlattening="False"
EntitySetName="tbICObjectBases" EnableDelete="True" EnableInsert="True"
EnableUpdate="True" EntityTypeFilter="tbICObjectBase">
<WhereParameters>
<asp:SessionParameter SessionField="Tag" Name="RecID" Type="Int64" />
</WhereParameters>
</asp:EntityDataSource>

You can see the model at [URL] Or [URL]

View 3 Replies

DataSource Controls :: How To Delete Related Data / Rows

May 5, 2010

How to delete related data.

Ex:

Tables:

1) Account: ID,UserName,Pass

2) Campaign: ID,AccountID,Date,Balance

3) CampaignSpec: ID,CampaignID,Spec,Color

Note: Account.ID = Campaign.AccountID and Campaign.ID = CampaignSpec.CampaignID

View 1 Replies

DataSource Controls :: All The Related Records Across Tables At The Same Time?

Mar 19, 2010

Let say you read a customer record into Customer object. Do it read all the related records across tables at the same time Or it only reads when you do from o in customerobject.orders

View 2 Replies

Architecture :: Difference Between Repository And Table Data Gateway

Apr 1, 2010

what is the difference between these two patterns?

View 1 Replies

DataSource Controls :: Linq Query To Select Parent Records Which Have Related Children

Jan 19, 2010

I have a basic CMS which I'm adding to a site to display some downloads organised into groups. I have two tables, one for the groups and one for the downloads. I'm using a repeated to display the groups with another repeater inside to display the children. This works perfectly.

However some of my download groups may not have any downloads related to them and I'd like to handle this by filter the groups so that only those with a relate download record(s) are shown.

I'm trying to do this with the query which populates the top repeater based on some ideas I read but I must be going wrong with the syntax.

Here is what I'm using to try and only select downloads groups which have downloads linked to them by the download group ID.

[Code]....

Can anyone offer any thoughts on how I should construct the query to perform this?

View 1 Replies

ADO.NET :: Display Value From Related Table?

Jan 18, 2011

I have 2 tables:

User(Id PK, TitleId FK, Name, Active)

Title(Id PK, Text)

Title is a lookup table of titles (Mr, Miss,...) and its got a relationship with table User by TitleId.

Now I'm trying to display the data in a web page using .net and Entity Framework. I'm using a ListView control and a query as a source. it all displays fine except for the Title.

Here is my code:

MyEntities _entities = new MyEntities (); User user = new User(_entities); IQueryable u = (from x in _entities.Users where x.Active == true select x); ListView1.DataSource = u; ListView1.DataBind();

and the code in the front end:

<asp:ListView ID="ListView1" runat="server" EnableModelValidation="True" DataKeyNames="Id"><ItemTemplate> <tr> <td> <%# Eval("Id") %> </td> <td> <%# Eval("Title.Text") %> </td> <td> <%# Eval("Name") %> </td> </tr></ItemTemplate><LayoutTemplate> <table ID="itemPlaceholderContainer" runat="server"> <tr runat="server"> <th id="Th2" runat="server"> Id</th> <th id="Th1" runat="server"> Title</th> <th id="Th3" runat="server"> Name</th> <th runat="server"> </tr> <tr runat="server" ID="itemPlaceholder"> </tr> </table></LayoutTemplate>

How do I manage to get the Title Text associated with a User to display on the ListView?

View 4 Replies

Forms Data Controls :: How To Show Data From A Related Table In A Gridview / Entitydatasource

Feb 23, 2011

I am using an ADO Entity Model for my ms-sql database.

My database has a Resellers table which has ResellerID (primary key, int) and Name columns along with other data.

I also have an Orders table which contains OrderID (primary key, int), OrderDate, ResellerID (foreign key to Resellers.ReselerID).

If I just do a query like:

[Code]....

I am able to reference order.Reseller.Name just fine with no problems.

However I have an EntityDataSource on my page as follows:

[Code]....

Notice the Include="Reseller" attribute in the datasource... I also have a GridView tied to that datasource as follows: I cut some of it off for breavity:

[Code]....

Now what I have listed above will run with no errors, but what I want to do is replace the column that displays "ResellerID" with the equivilant to order.Reseller.Name. In other words I want my grid to display the reseller's name rather than the numeric ID.

I have tried to change the DataField to "Reseller.Name" but that will generate the following error:

A field or property with the name 'Reseller.Name' was not found on the selected data source.

Is there anyway to do this without me writing a custom select statement in my code behind?

View 2 Replies

Forms Data Controls :: Gridview Column With Data From Related Table In SQL Db?

Aug 18, 2010

I've got a gridview that is databound with LINQ in the code behind. One column shows the id from the table. I would like to show a more human friendly product name that is associated with that id number but is from another table. Thought I had it figured out by entering a Template field in the gridview tags (in the .aspx page) and an item template within that with

<ItemTemplate>
<%Eval(Products.productName")%></ItemTemplate>

but when I try to build it says this can only be done in the context of a databound control.

Can I add this column within the gridview tags or does it have to be done from the code behind?

View 3 Replies

Security :: Retrieve Current Username - Get Currentuserid

Feb 23, 2010

I could retrieve current username, but how Could I get CurrentUserID. I ma using builtin asp.net membership provider and UserID field is UniqueIdentifier.

View 5 Replies

DataSource Controls :: 2147467259/A Network-related Or Instance-specific Error Occurred While Establishing A Connection To SQL Server

May 21, 2010

I am using Asp.Net MVC 2.0 for creating a user and assigning properties to the user at the same time. I am using my Windows account to access database on my local computer. I am using pre-installed MVC code o create a user with unique user name and password. User is created OK. Then I want to add profile properties like First and Last name at the same time.

I am creatingProfileBase object:

ProfileBase profileBase = ProfileBase.Create(profileInformation.UserName);

where profileInformation is a RegisterModel and has user info.

When I am trying to:

profileBase.SetPropertyValue(.....);

I am getting the following error # 2147467259 A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Shared Memory Provider, error: 40 - Could not open a connection to SQL Server)"}

Why is my connection string works fine the first time and not working now? And how to configure connection to use TCP-IP?

I have SQL Server Browser running ander Local account and openned port in my Firewall.

View 4 Replies

MVC :: How To Get Related Table Data / How To Access Groups Table Data From View

Mar 30, 2010

I have a strongly typed view for Contacts table In my index page , i am accessing the tables as --- "foreach (var item in Model)"

This table has an association with Groups Table

How can i access Groups table data from view.

intellisense gives me possibility to write like "item.Groups.GroupTitle"

But it returns null(object not initiated) How to solve this?

View 3 Replies

Sorting A GridView Column Related To Other Table?

Jun 10, 2010

i have a GridView bound to a DataView. Some columns in the DataView's table are foreignkeys to related tables(f.e. Customer). I want to enable sorting for these columns too, but all i can do is sorting the foreignkey(fiCustomer) and not the CustomerName.

I have tried this without success(" Cannot find column ERP_Customer.CustomerName "):

<asp:TemplateField HeaderText="Customer" SortExpression="ERP_Customer.CustomerName" >

A tried also the DataViewManager, but i've a problem to detect the table to sort:

[code].....

I have to apply the sort on a distinct table of the DataViewManager, but this table would differ on the related tables.

I have bound the TemplateColumns in Codebehind in RowDataBound-Event f.e.:

Dim LblCustomer As Label = DirectCast(e.Row.FindControl("LblCustomer"), Label)
LblCustomer.Text = drCharge.ERP_CustomerRow.CustomerName 'drCharge inherits DataRow

What is the recommended way to sort a GridView on columns related to other tables? I could build a custom datatable with the customername instead of the foreignkey and bind this column to the TemplateField. But then my huge dataset in the model makes no sense anymore.

EDIT: I have a model with a Dataset. I'm binding one Datatable(ERP_Charge) from it to my GridView(actually i take a Dataview from that Table). In this Datatable are columns that are related to other Datatables in the Dataset(relations are defined). When i want to make the grid sortable its no problem on the columns that belong to ERP_Charge.

But the columns with foreign keys to other table could not be sorted because the Gridview shows f.e. not the CustomerID but the Customername. I get the Customername in RowDataBound. Normally i would join the tables and add a Datacolumn for the Customername.

View 1 Replies

ADO.NET :: Checking For Valid Related Table Data In EF?

Nov 7, 2010

I've always been a bit unsure how to check for the existance of properly referenced table data.

In my situation I have various tables related to each other in many-to-one relationships where the "1" side can be deleted without the reference fields on the "many" side being updated (nulled).

I have FK relationships set up in my MS SQL server database but have turned off the FK constraint enforcement (and cascading update/delete) so that I can delete records from the "1" side but leave the keys for those deleted records in the records on the "many" side. This is something I really need to do for my web app design.

View 1 Replies

C# - Get Field Descriptions From A Parent Related Table In A Gridview

Aug 6, 2010

What would be the best way to set a gridView.DataSource for LINQ query with some foreign keys and get fields in the parent tables? Like this:

The table BOOK have a Author_Id, which is related to table Author

class:

public IQueryable<Book> ListAll()
{
RENDBDataContext db = new RENDBDataContext();
var result = from b in db.Books
orderby b.Id descending
select b;
}
code-behind:
grdBooks.DataSource = vBooks.ListAll();
grdBooks.DataBind();

In the ASPX page I can get to the Author name with the [asp:TemplateField], using <%Eval("Author.Name")%>

What I'm looking for is a better solution, that doesn't involve changes in the aspx page

View 1 Replies

Using A Grid That Isn't Related To A Datasource?

Jun 10, 2010

What i want to do is have a grid i can add rows and columns and cells. each cell i want to have an image button in. I want to do this in a windows form. Is this posible? I was looking into the gridview/datagridview but that wasn't what i wanted.

View 1 Replies

DataSource Controls :: Getting Error / A Network-related Or Instance-specific Error Occurred While Establishing A Connection To SQL Server.

Apr 22, 2010

Following is the error I am getting while accessing some of the pages on my website.

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

It is trowing an exception and giving the about mentioned error.

View 5 Replies







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