I am using Vb 2010 in designing my apps. I've connected my database with my application but I didn't use any code in the connection. I used Data source and Databinding property and when I save the data the database is always empty. Please help me with a solution.
Place a BindingNavigator component in your form and set it's binding source property to the same datasource of your other component.
Related
So I am trying to create my ADO Entity data model, and i cant seem to get past the "choose your data connection" page. I choose the correct connection, then click either no or yes for sensitive data, and i click next. However, nothing appears. There is no error message like the common "your project references the latest version of entity framework however an entity framework database provider." It just closes the prompt and returns me to my project.
Has anyone ever seen this before?
If you have such a problem, make sure that the version of the NuGet MySQL EF package matches the version of the MySQL Connector for NET
How can I store in a MDI Application (MFC) much data in the Document (CDocument) class? There is no database or something. I've got a dialog where I can type in adresses. This adresses must be stored.
I hope you understand my question.
Sincerely
Your CDocument derived class should access and store the data needed by your app. It can do this with member variables (appropriate data structures) that you add or it can do it via a database if you want a database. For example, the MSDN sample named ENROLL shows a CDocument that manages the connection to a database.
my working environment is C#, Visual Studio 12, entity framework 5 DBContext, SQL Server 2008R2.
the generated entities sets are generated as Hash sets.
xtraGrid.DataSource = _order.OrderLines;
when I type data in the new row, data disappears when focus lost.
With using older entity framework, this logic was working.
What type should I choose for my entity set in order to solve my problem.
Thanks.
I changed type from HashSet to BindingList, and it works, God thank you.
I am currently trying to setup an ASP.Net MVC 3 Application for the first time. I know what I am doing with Ruby on Rails but completely lost with ASP.Net. I would like the app to create the database but not sure what I am doing wrong. I have an empty Database build called ssDB. I have setup the connectionStrings and built out the Model classes. According to everything I have read thus for, when I go to the run the App it should create the database but it doesn't look that way.
The Abbreviated Error I get is:
InnerException: System.Data.SqlClient.SqlException
Message=Invalid object name 'dbo.Users'.
Source=.Net SqlClient Data Provider
ErrorCode=-2146232060
Class=16
LineNumber=1
Number=208
Procedure=""
Server=TESTSVR01
State=1
I have an empty Database build called ssDB
You have created an empty database with no tables. Since there is a database EF assumes tables are also created. Hence it will not proceed to create the tables.
You can drop the database and allow EF to create the database and the tables.
I also experienced the same issue while using Database first approach. Connection string in my service's/service's host web.config was incorrect. I corrected the connection string and it worked.
For strongly-typed & type-safe solution, I have to do the following step.
Create some Silverlight application.
Binding input control to Linq data class.
Validate data by using rule from attribute of data class.
Send data to server via WCF.
But, I have some question.
How to bind input control with linq data class property?
How to do that with minimal tiers(layers) and minimal required dll(for Silverlight project)?
PS. .Net RIA Service - May Preview isn't my final answer. Because size of all required dll and some generated code.
Thanks,
Well, I'm glad you know that .NET RIA Services will provide all of those things but I understand size is a consideration. Keep in mind though, since it looks like you're considering Silverlight 3 you can use the option to cache the framework assemblies to greatly reduce your Xap size:
http://www.wintellect.com/CS/blogs/jprosise/archive/2009/04/06/silverlight-3-s-new-assembly-caching.aspx
I'm not positive that caching applies to the RIA Services assemblies, but if so it would mean they're downloaded only once.
Assuming that's not what you want there are 2 other options to get data from the Linq classes (I'll assume you mean Entity Framework classes) to the client. The most simple method would be to create your own WCF Service as you've mentioned. That way you write data classes on the server and proxy classes automatically get generated on the client that mimic the server classes. The drawback here is business rules won't be shared between the two. So your data validation attributes will need to be written and enforced on the client & the server separately.
The next option is to use ADO.NET Data Services to move the data from the server to the client. This is a step above the previous option in that you won't have to write a WCF service yourself to host the data; it's generated for you. Of course it requires an extra Dll to be packaged in the Xap.
To answer some of your questions directly:
You can't ever bind an input control directly to a Linq data class. You can only bind controls to the client side proxy classes that are generated by referencing a WCF service (either one you wrote yourself or one provided by ADO.NET Data Services).
If you don't use .NET RIA Services you'll need to create a custom attribute to link to your business rules, then handle events on the data bindings manually to read the attribute and enforce your rules.
Use either of the above options to send data to the server - either your own custom WCF Service or ADO.NET Data Services.
Your final question about binding an input control to a property looks like this:
MyControl.xaml.cs:
public MyControl() {
this.DataContext = new LinqDataClass();
}
MyControl.xaml:
<TextBlock Text={Binding PropertyOnLinqDataClass}/>
Here, LinqDataClass is the client side representation of your server side Linq data class and has a property called PropertyOnLinqDataClass. You'll need to implement the INotifyPropertyChanged interface on the client side to properly support 2 way data binding.