I have advice that this might work for programmatically filling a set of literals from a set of object properties:-
[code]....
However, the line: ctl.Text = pageData.help(i).trim() fails because it's not understood that pageData.help(i) should translate to pageData.help1, pageData.help2, etc.
I am trying to configure NHibernate on my console application in which I am trying to map an Employee class to a table Employee.I am getting below exception which I have no clue:
Class: class Employee { public int id; public string name; [code]...
I have a Data list, inside that i have a repeater, inside the repeater i have a panel.hat i want to do is reference my panel (Panel1) so that i can change the visible properties when a link button is clicked. However as this is inside a dynamic control i am a bit lost in how to reference it! This is my code
I'm making the leap to move from vb.net to C#, and I'm getting this crazy error when I try to execute one sp, set a value, and then execute another sp based on the value. proc_GetSectionDetails is my first stored procedure. From that, I get a value for SectionID, and then use it for the second sp called proc_GetSectionDetails
I'm trying to pass email addresses from an array to a stored procedure, then display the results in my gridview. I get the following error:No mapping exists from object type System.String[] to a known managed provider native type.On this line: Dim DR As SqlDataReader = MyCommand.ExecuteReader
I am trying to get an asp: literal to work but apparently I am doing something wrong because I am getting an Object Referece not set to an instance of the Object
I have some datatables in a LinqToSql entity model (edmx) that are structured like this: SalesOpportunity *<-1 User *<-1 Person i.e Many SalesOpportunities / 1 User, Many Users / 1 Person Anyway, My DomainService is SalesOpportunity centric, and I want to serialize info about the person into the metadata class. I can serialize data about the user without any problem like this:
MetaData Class: <Include("UserName", "UserName")> _ Public User As User DomainService Class - GetOpportunities() Return Me.ObjectContext.Opportunities.Include("User")
I've been trying for several hours to get the Person information. If you have any tips, I'd be grateful to hear them.
Here's my problem: I have an IPerson which is implemented by Employee and Student. What I really want is what you see below. One LINQ statement to get each type of IPerson. This works great until I call the method ;). It makes sense as to why I'd get the error, but I am really struggling as to find a decent way to pull all IPerson objects from the DB and avoid putting switch statements all over my application.
[code]....
Above, there is a commented out return statement - that essentially does a .ToList() and forgoes the whole deferred execution thing, creating 2 SQL statements - not ideal.
I'm running Visual Web Developer 2010 Express on Windows XP and I'm having some trouble linking my DataContext to a control.If I create a new "Web Site", add a new LINQ to SQL Class and add the database tables I want, then add a Control such as FormView and choose a new LINQ Data Source Type; my DataContext I created is visible in the list and all work OK.If I do the same after creating a new "Web Application", my DataContext doesn't show up in the list, but if I go into my Code Behind I can access my DataContext through:
I need to create a .XLS file and put it available for download in my .aspx page. this file is needed to have information from database. I'm using Linq to SQL. So I need a C# code for reading from DataBase using Linq and create a .XLS file for download.
I am probably doing this wrong but I want to take all words entered in to a text box and return all records that contain any or all of the words. Can any one point me in the right direction?
protected void ldsGvFaqs_Selecting(object sender, LinqDataSourceSelectEventArgs e) { if (txbSearch.Text.Length > 0) { string temp = string.Empty; string[] words = txbSearch.Text.Split(' '); int counter = words.Length; foreach (var word in words) { temp += "Tags.Contains('" + word + "')"; counter -= 1; if (counter > 0) { temp += " || "; } } ldsGvFaqs.Where = temp; } }
But I get the following error, Character literal must contain exactly one character.
I have a bunch of tables which are related in various ways, and I drag and drop them into the MSLinqToSQLGenerator, then save etc. But theres a couple tables and a few columns from other tables that don't get recognized in my code, despite repeated regenerations and trying to create a whole new file, it keeps telling me the fields dont exist when I try to use them, meanwhile I'm using other values from the same tables(the ones that where values are missing from) just fine... The Missing tables are defined in the generated classes, as are the values along with property functions... I'm not using any custom tools either... just straight ms visual web developer 2010 express...
Dim newMem As New Subscription With { _ .First = txtName.Text, _ .Email = txtEmail.Text, _ .dateLastEmail = "1/1/1980", _ .subDate = Now} dbp.Subscriptions.InsertOnSubmit(newMem) dbp.SubmitChanges()
The table contains a field called conDate that is nullable, and in this case I want it to remain null. It will get a date value later, when a confirmation is received. If I add .conDate = "1/1/1980", _ I can successfully add the record, but without that line I get System.InvalidOperationException: Nullable object must have a value. I tried this:
Dim DateConfirm As System.Nullable(Of DateTime) = Nothing and adding .conDate = DateConfirm, _ but that didn't help either. How can I add a record without giving a date to a field I want to remain null?
I'm using MVC 2 with some Models from a LinqToSql project that I built. I see that when I post back to a Controller Action after editing a form that has a DateTime field from the Model, the MVC Html.ValidationMessageFor() helper will nicely display an error beside the Date text box. This seems to happen automatically when the you test ModelState.IsValid() in the Controller Action, as if the MVC model binding automatically knows that the DateTime field cannot be empty.
My question is... I have some other string fields in these LinqToSql generated classes that are Not-Nullable (marked as Not Nullable in Sql Server which passes thourgh to the LinqToSql generated classes), so why doesn't Mr. MVC pick up on those as well and display a "Required" message in the ValidationMessageFor() placeholders I have added for those fields?
Sure, I have successfully added the MetadataType(typeof<t>) buddy classes to cover these Non-nullable string fields, but it sure does seem redundant to add all this metadata in buddy classes when the LinqToSql generated classes already contain enough info that MVC could sniff out. It MVC validation works with DateTime automatically, why not these Not-nullable fields too?
This is my first attempt at updating a database using LINQtoSQL. At least, it's my first if you don't count the tutorials I've followed. Unfortunately, The tutorials that I have found don't offer much more than updating a single table. I'm attempting to update a DB Model that's a bit more complex.
I am writting a website using .net in some of my pages I need to use datagrid for showing some datas and for binding my data to datagrid I use object datasource something like below :
//this is public class userData { private long userid = 0; private string username = null;[code]....
and then in my apsx file I put an objectdatasource and bind the select statement to the GetUsersAmount() and then bind obejctdatasource to my datagrid but I think the way I've chosen is not efficient I just want to hear about your way of doing such these things.
I am trying to access the page object in module and change the hyper links urls. Page object is being access properly, but changes I am making are not effecting the output. I mean here I am changing the url to TestURL.aspx, but this is not comming. could
I am using Session state in my ASP.NET application. The development is done using InProc session state as the option, but now the application is deployed on a Web Farm(Cluster) environment. As a result, InProc session state is not working.
I have changed the session state mode to SQL server so the session state will work in Web Farm environment. But now i am getting a different error because of some of the objects which i have already used with Session.
Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.
I understand that every object that is stored in Session needs to be serialized. But there are some objects which are not serializble in DOTNET.
Unfortunately i am using one of them, SiteMapNode. I am storing this object in session to re-create the breadcrumb based on the navigation the user has performed. I have to do this because there are mulitiple paths leading to single page in my application.
I have tried to do serialization of this object using XML serializer object, but its throwing an exception:
"System.Web.SiteMapNode cannot be serialized because it does not have a parameterless constructor."
I can't change the code of storing the SiteMapNode in session as it is very complex and written by someone else. I have to store this object in session or some other state form so that i can continue using the same code.
Even though I when I create a linqtosql class I mark C# as the language it was always shows up as a Visual Basic file in the App Code file. I can't get it to stop doing that. ????? What is going on?
I have a textbox,I can enter data like this(1.20.1000),I want to split this one into 3 parts Stored in another table in 3 columnsĀ andĀ also store same(1.20.1000) values in another table 1 column,
How can i do this perform this 2 operations at a time using MVC with LinqToSql ....
I have two linqTOsql entities that has a parent and child relationship, one to many. I'm running into an issue that when I retrieve the parent record, I am unable to loop through the related records in the child table.This code fails: