C# - LINQ2Entity Framework Query Acting Strange?

Feb 20, 2011

I have strange problem with my query. I have two almost identical situations in which one query is acting as it should be while the other gives errors.

var osobaIme = (from o in db.osobas
orderby o.osoba_ime
select o.osoba_ime).ToList().Distinct();

[code]...

View 2 Replies


Similar Messages:

ExtJs Grid Acting Very Strange

Oct 18, 2010

So I have two pictures of the weirdness that is occuring.As you can see in the picture above, the scroll bar on the right hand side is being cut off a little bit by the screen, and even when you scroll to the right, you don't get the bar back, it remains cut off.

Here is the other scenario:

Here, you can see that when I scroll down in this grid, the scroll bar kind of fits into the bottom of the grid and doesn't even go all the way down. You need to manually click into the grid and hit the down arrow to get the rest of the way down.

Edit: Here is the code to generate the grid (Ext created through VB controls):

Dim VehicleOptionsGrid As New Akcelerant.Framework.WebControls.Grids.Grid
With VehicleOptionsGrid
.ID = "VehicleOptionsGrid"[code].....

View 1 Replies

ADO.NET :: [Entity Framework] Strange Error Executing A Sql Query

Nov 29, 2010

I have a strange error, I've tried to search for it before writing this post but I wasn't able to find out a solution yet.

I'm executing a query using ExecuteStoreQuery against a MySQL database, but it throws an exception reporting that there's a syntax error in my SQL.

I've tried to copy&paste the sql query into the MySQL tool and it works nicely, giving the correct results.

I've tried to open manually the connection and using CreateCommand to use it the "old way".

My query is a bit long, 4000 chars more or less, could it be the problem?

View 4 Replies

Forms Data Controls :: Strange Behavior After Upgrading To Win 7/Framework 4.0?

Feb 9, 2011

I have a site that was sucesfully upgraded to Framework 3.5 on Vista with VS2008. Now however after installing VS2010 and upgraded to Win 7 wierd things are happenning and was wonderring if any of you have experienced this and how you've dealt with it.First thing I notice in my main page that the four user controls are not in alignment. They should appear side by side in a single row, however now they spread acros two rows with one on top and three on the bottom. Also my graphics and navigation is not where they supposed to be. Just for comparison, if run the existing solution on Win 2003 with VS2008, it works like it supposed to. All the formatting is handled in .css and that didn't change either.

[Code]....

[Code]....

View 1 Replies

C# - How To Use Strange Characters In A Query String

Apr 14, 2010

I am using silverlight / ASP .NET and C#. What if I want to do this from silverlight for instance,

// I have left out the quotes to show you literally what the characters
// are that I want to use
string password = vtakyoj#"5
string encodedPassword = HttpUtility.UrlEncode(encryptedPassword, Encoding.UTF8);
// encoded password now = vtakyoj%23%225

URI uri = new URI("http://www.url.com/page.aspx@password=vtakyoj%23%225");

HttpPage.Window.Navigate(uri);

If I debug and look at the value of uri it shows up as this (we are still inside the silverlight app),

[URL]

So the %22 has become a quote for some reason.

If I then debug inside the page.aspx code (which of course is ASP .NET) the value of Request["password"] is actually this,

vtakyoj#"5

Which is the original value. How does that work? I would have thought that I would have to go,

HttpUtility.UrlDecode(Request["password"], Encoding.UTF8)

To get the original value.

View 2 Replies

ADO.NET :: LINQ Entity Framework Query - Construct "nested" Query?

Jan 22, 2011

I have a web app for our golf club. When I compute handicap index for each golfer, I have to select the most recent scores and then a subset of those scores depending on how many rounds of golf the golfer has played. All the scores are entered into a single SQL Express table called "Rounds". Verbally, this is what I'm trying to do:

1) select the twenty most recent golf scores (sort on date descending, "take(20)") [if less than 20 records, then select all available];

2) for this set of records, select the 10 lowest scores (or smaller number if golfer has less than 20 rounds);

3) compute the average round differential for the subset of records, etc. to calculate handicap index (this step is working ok...)

My current VB code has this LINQ query (which is flawed -- it selects the lowest handicap differential scores of ALL records for the filtered user):

[Code]....

How do I modify this query to accomplish items 1) & 2) above? It seems this should be simple, but my experience with queries is still limited.

View 2 Replies

C# - Radio Buttons Are Not Acting As A Group

Jan 13, 2011

I am using Radio buttons inside a panel in a web page. (Since group boxes are not there). But when I click on each radio button they all are checked. They are not acting as a group but single units.

View 3 Replies

ADO.NET :: Entity Framework - Query Based On Relationships?

Oct 27, 2010

I have the following related tables:

Users
Id
Username
Email
Password
UserStatuses
Id
Name
Users_UserStatus
Id
User (FK - Users: Id)
Status (FK - UserStatuses: Id)
StatusDate

As you can see, UserStatuses is a reference table with various statuses. Users_UserStatus is a join table between Users and UserStatuses. Using Entity Framework, how can I do a conditional to check if the latest StatusDate is "Pending"? As of now, I have the following:

[Code]....

View 1 Replies

Forms Data Controls :: Two More GridViews Acting On Each Other

Mar 28, 2011

I have a couple grid views one for Team Goals and one for Indicators for the Goals I want to be able to click on an indicator and it highlight the Goal in the other grid view both on the same page. I also want to be able to click one of the indicators and open a entry screen I assume for that I use the select portion of the control?

View 2 Replies

Master Page Acting Wired On Different Pages

Aug 26, 2010

I applied this master page to two files..one inside the same folder(file1.aspx) as the master page..another outside(file2.aspx)..master page is applying alright to file2.aspx BUT not completely..a TD's bgcolor is missing..and ONLY that..why so TH files got no code of their own yet..just the application of the master pag

View 1 Replies

ADO.NET :: After Domain Changed TransactionScope Acting Wierd?

Feb 18, 2011

I m using transactionscope and there was no problem until my domain changed.When it hits the scope7, it inserts the data and starts all over again and inserts for the second time.

Here is my sample code:

Using scope7 = New TransactionScope(TransactionScopeOption.RequiresNew)
Dim comm As New Data.SqlClient.SqlCommand("INSERT INTO ABC (ID, AID, Type) VALUES (@ID, @AID, @Type)", conn)
comm.Parameters.AddWithValue("@ID", TaskID)
comm.Parameters.AddWithValue("@AID", FormID)
comm.Parameters.AddWithValue("@Type", FormType)
conn.Open()
comm.ExecuteNonQuery()
scope7.Complete()

View 1 Replies

C# - Jquery Click Tracking Is Acting A Little Strage?

Apr 21, 2010

On some links on my HTML page I have a special CSS class, that when clicked, I make a ajax call to a click.aspx page and track the click.

<a href="..." class="click" id="blah-1">blah-1</a>


$(".click").bind("click", function() {[code]....

So what is happening is the value of source, after clicking a few links (that open in a new window) becomes:

source=blah1
then it becomes
source=blah1,blah2

View 1 Replies

Show SQL Trace Of LINQ Query To Entity Framework 3.5

Oct 13, 2010

Best way to show the SQL trace of a LINQ query to Entity Framework 3.5? I am using ASP.net and EF 3.5.

Dim dbo As Web.Portal.RBMEntities = New Web.Portal.RBMEntities
Dim Query = From RoleAllocations In dbo.RoleAllocations Where RoleAllocations.user_id = _ID And RoleAllocations.expire_date > Today Select RoleAllocations

Console write the SQL trace?

View 2 Replies

Entity Framework CTP5 - Code First - Nested Query Error

Jan 3, 2011

I have the following classes:

public class Category
{
public int CategoryId { get; set; }
public string Name { get; set; }
}
public partial class CategoryMap : EntityTypeConfiguration<Category>
{
public CategoryMap()
{
this.HasKey(c => c.CategoryId);
this.Property(c => c.Name).IsRequired().HasMaxLength(400);
}
}
public class MyObjectContext : DbContext
{
public MyObjectContext(string connectionStringName)
: base(connectionStringName)
{
}
public DbSet<Category> Categories { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new CategoryMap());
base.OnModelCreating(modelBuilder);
}
}

Now when I run the following code I get an exception (GenericArguments[0], 'System.Int32', on 'System.Data.Entity.Internal.Linq.ReplacementDbQueryWrapper`1[TEntity]' violates the constraint of type 'TEntity')

DbDatabase.SetInitializer<MyObjectContext>(new DropCreateDatabaseIfModelChanges<MyObjectContext>());
using (var context = new MyObjectContext("NopSqlConnection"))
{
var query1 = from c in context.Categories
select c.CategoryId;
var test1 = query1.ToList(); //works fine
var query2 = from c in context.Categories
where query1.Contains(c.CategoryId)
orderby c.Name descending
select c;
var test2 = query2.ToList(); //throws the exception
}

View 1 Replies

ADO.NET :: Setup Query Result Shaping For LinQ To SQL Instead Of Entity Framework?

Sep 9, 2010

I am new to this, and I am trying to implement a linq query similar to db.Genres.Include("Albums") command from

mvc music store using my current DB setup. I realize that the tutorial mentions Checlking the "Include foreign key columns in the method" when creating the tables in ADO.NET, but if I am using LINQ to SQL classes, then how can I obtain the same effect. And how do I use
db.Genres.Include("Albums") to simplify my life?

View 2 Replies

Architecture :: Ado.net Entity Framework - Query - Return Correct Data

May 26, 2010

I just tring to a complex (for me) with ado.net entity framework this is the structure: In practice it is a sort of group purchasing (Buyers) For each group of purchase (Buyer) should have the opportunity 'to select all products of the brands indicated in buyer I'm doing function to return correct data like this:

public List<Product> GetProductsByBuyer(int vBuyerId)
{
Buyersctx.Products.MergeOption = MergeOption.NoTracking;
return (from lProduct in Buyersctx.Products.Include("Brand").Include("Buyers")
where select lProduct).ToList();
}

View 2 Replies

ADO.NET :: How To Access The Grouping Resulted From A Entity Framework Query With Group

Mar 26, 2011

I'm currently learning entity framework (from the Julia Lerman book "Programming Entity Framework") and got really confused at the grouping part.

var contacts = from c in context.Contacts
group c by c.Title into myGroup
select myGroup;

This is supposed to return a Grouping<K,T> type, but the book didn't give an example on how exactly do I access this "contacts" query and I can't figure it out. When I did foreach(var contact in contacts), my "contact' variable has no knowledge of any of the properties of the Contact type (contact.FirstName etc).

View 1 Replies

Web Forms :: Entity Framework With Stored Procedure Using Defining Query

Jun 28, 2012

I wrote a defining query

 <EntitySet Name="EntityFramework" EntityType="SEOAnalysisModel.Store.EntityFramework">
<DefiningQuery>
SELECT Keyword, ResultHead ,Year from SeoAnalysis where Year = 2005

[Code].....

And this column value is repetative.

Now how can i get all column value?

View 1 Replies

Can Check Rows Returned In A QueryString Parameter Based Entity Framework Query

May 29, 2010

I need to check if any rows are returned in a QueryString here's what I have so far.not sure what code to put to see if the row count is greater than 1

private void BindDataToGrid()
{
//MessageBoardEntities3 is ThemeableAttribute connection string name
int TID = Convert.ToInt32(Request.QueryString["ThreadID"].ToString()); // if Post ID is int
var context = new MessageBoardEntities3();
gvPosts.DataSource = from p in context.Posts
where p.ThreadID == TID
select new { p.Post1, p.PostID };
gvPosts.DataBind();
lblNoPosts.Text = "No posts found for this thread.";
}

View 1 Replies

C# - ValidateRequest="false" Is Acting Wierd?

Apr 4, 2011

(ASP.NET 4.0 C#)

I have my <httpRuntime requestValidationMode="2.0" /> in the webconfig. AndI have my validateRequest="false" in page directories.On one page, I send some data (html) from a ckeditor (textarea) to a database. Works fine.On another page I fill the ckeditor with data from a database, then I update it (send it back), and I get the famous "A potentially dangerous Request.Form value was detected from the client."

Makes me very confused. The only difference is that on the second page the data gets dynamically inserted into the textarea, where on the first page the textarea is empty on pageload. Am i missing something here? Im pretty sure Encoding/decoding doesnt mean anything, as the framework stops it before I can even start messing with it on the backend.

View 2 Replies

Vb.net - Strange IIS/ASP.NET JIT Compilation

Jan 19, 2010

I've got extremely strange behavior on one of my pages. I was able to get a work-around in place, but I'd like to get input on why this error is happening (and why my work-around actually works).

(Let me also say that this is in no way, shape, or form my code...so please don't bash me too hard)

When loading the page, we're getting

BC30456 'InitializeCulture' is not a
member of...

I worked through the tips here and nothing worked:

BC30456 Fixes

I was able to get the page back up and working by changing

<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="newsproduct_rss.aspx.vb" Inherits="product_nrss" %>


to

<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="newsproduct_rss.aspx.vb" Inherits="product_nrss" Debug="true" %>

View 3 Replies

C# - Strange Error From PDF4NET

Nov 30, 2010

I am using pdf4net to export PDF file. In C# I created complete logic to export data. A large part of it is legacy code so I know for sure that it works. But there is one little problem. Error in the end of code. Everything before that line is fine I check it several times. Bellow is the last line in code and bellow it is error that I receive after that line:

return pdfDoc.GetPDFAsByteArray();
at
O2S.Components.PDF4NET.Graphics.PDFBrush..ctor(PDFBrush
brush) at
O2S.Components.PDF4NET.Graphics.Shapes.PDFHTMLTextBox.boolean(Stream[code]....

View 1 Replies

Strange Characters After HTML Output

Feb 12, 2010

Recently I started a project and added a HTML file in it. I modified the HTML file and run it in Visual Studio to see the output. When I tried to validate the HTML file, I found some strange characters got appended. This is quite annoying, although I am not able to see those unexpected characters, I wonder what is the cause of the problem. I didn't adjust anything in control panel of the IIS server, I didn't modify the Web.config file. I tried to add another HTML file and put the same content into it, the same problem occured. Could someone tell me how should I troubleshoot the problem?

View 7 Replies

Strange Characters While Trimming String

Feb 21, 2011

using vb.net/asp.net 2005 and sql server 2005. I'm querying the database and returning text which I am then adding to a string. I'm creating a crystal report with the text however this is not a crystal report question, its about the string data. what I"m noticing is that when I show the string on the pdf that there are some strange characters at the end of the string. I am both trimming the string and taking out null characters however the strange text shows up like this:

strangeText>
SÙÇ
TÙçy|Ü
DÙÇ
$ÛÇ
</strangeText>

does anyone know what these characters are and how to get rid of them?

View 7 Replies

VS 2008 Strange Intellisense Error?

Mar 2, 2010

I have this strange error coming up in VS2008, where is says a variable in not declared in HTML view, when it clearly is declared in the codebehind:Can anyone help with why this might be happening? I've tried all sorts of things, even recreating the page from scratch, but this keeps coming up.

View 32 Replies







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