ADO.NET :: Creating Dataset Wrapper In C#?
Oct 15, 2010creating dataset wrapper in c# with sample code..
View 3 Repliescreating dataset wrapper in c# with sample code..
View 3 RepliesToday we have a windows application that, using an OCX, creates a web page (visible by a WebBrowser control in a small .NET WinForm application) and communicates through COM to the main application/client. (not relevant but this is Pascal)
I'm currently responsible to re create this application in a web environment so we can have the same functionality shared through Web as the user can see the same in a Web Browser.
The Windows application has almost 4 years on it and I need to re create everything from scratch, and all the bugs/features find in the future in the Windows Application I have to re create them again in the Web...
is there any way I can create a Wrapper, even using 3rd party commercial objects, to:
Communicate with the COM Object Can expose the content of the OCX (this in my most confortable language, ASP.NET C#, but other are welcome) I was thinking out loud, can this be accomplish with a Java Applet? Silverlight 4?
I'm trying to create a SessionManager class which I can use to manage sessions in my MVC applications. For that I'm thinking the best way of doing so is by creating a wrapper class for HttpContext which would then allow me to access HttpContext.Current.Session.
To be honest, I'm not really sure about the whole thing, I just feel it's the logical way of doing so. I also want to create an ISessionManager and ISession interfaces, and then implement them according to my application's needs. For my current project, and for now, I need a InProc session management, but I might need to store session data in MSSQL Server when we decide to expand and use a web farm or a garden. That's why I'm trying to build a sort of an extensible framework right from the start.
Final note, I will be using Microsoft Unity to inject the concrete SessionManager of choice. I believe that's a good way to maintain a certain level of abstraction.
I have a detailsview, template as follows:
[Code]....
Codebehind: creating dataset, getting data from sql with adaptor and filling into dataset object, then setting detailsview's datasource.
I add 2 button to above template to able to edit data at asp page, and added event handlers:buttons:
[Code]....
My question is, what to do inside the detailsview update event function to able to edit and update data. My method can be wrong too.
Real simple one here. I'd like to create a table on my Page from a DataSet. It looks like I have it working properly, but what I'd like to do is interpret the columns, as well as be selective with which column to display.
[Code]....
I would like specific columns, by name or position doesnt matter.So if a column is = named column, then addcell and also, the data needs to be interpreted: If value of column = x then response.write("y")
In sum, I dont want all the columns, just specific ones, then I was to interpret whats in that cell, and write something.
[Code]....
I'm new to creating reports. I created a report rdlc, and created three report parameters and placed in data region. See the code below
[Code]....
When I build this..I got the error saying "The table 'table1' is in the report body but the report has no data set. Data regions are not allowed in reports without datasets. "
I need to create rdlc without dataset and to bind dataset at runtime.
I am using Linq To Sql to get List of objects with data from database. To bind data with a grid view i am creating a dataset explicitly and then adding List values to that explicitly created dataset.
Now my question is whether it is a good pratice to do what i am doing (in terms of resource utilization) or is there any better way to this...
I have a dataset with 3 tables that are inner joined. Thsi dataset is connected to an object datasource which is connected to a gridview. So at runtime it displays data from the database. The problem is when I click on a save button to add information to the database it throughs me an error saying Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. But if i have two tables in my dataset it works 100%. But the problem i need that 3 tables in order to pull the required information. And if i populate the gridview using code to select the information from the database and insert information it also works 100%.
View 3 RepliesI'm creating a form that sends a data set into an XY scatter plot. I have a report and reportviewer set up correctly, however my chart will not adjust the vertical position of the data points! They're tied to the table below (and have data labels), however when they get plotted they're always right on the x-axis.
View 1 Replieswhen i add a dataset & using wizard trying to set the database using sql authentication.i get error login failed for user sa but if i use windows authentication i get connected.i checked the sql server it has mixed authenticationĀ but still i am not able to create the xsd & supposeĀ i copy the the dataset mad eon other system to this system i am bale to aceess the data in the application but not able to configure or preview data.how do i rectify .
View 1 RepliesI have tried with the same code as per the link
[URL]
Attaching dataset (data) to the reportviewer (report) dynamically at run time:
[code]....
I have a relatively complex dataset (numerous tables, some with multiple records) generated from reading in an XML file. I need to connect said dataset fields to an ASP form. At the moment I'm assigning them manually, like so in the pageload:
txt_first_init.Text = formData.ds.Tables["phrmHdrKey"].Rows[0]["first_init"].ToString();
txt_last_name.Text = formData.ds.Tables["phrmHdrKey"].Rows[0]["last_name"].ToString();
ddl_pregnancy_flag.SelectedValue = formData.ds.Tables["pPhrm"].Rows[0]["pregnancy_flag"].ToString();
And conversely when it's time to submit.
formData.ds.Tables["phrmHdrKey"].Rows[0]["first_init"] = txt_first_init.Text;
formData.ds.Tables["phrmHdrKey"].Rows[0]["last_name"] = txt_last_name.Text;
formData.ds.Tables["pPhrm"].Rows[0]["pregnancy_flag"] = ddl_pregnancy_flag.SelectedValue.ToString();
I did some looking into binding the textboxes (and dropdownlists, and checkboxes, and and and...) directly, but it seemed to be too many formats to use.
So this works fine, but as the number of fields increases, those load and unload lists are going to get unwieldy.
I am new to crystal reports and I would like to know to create reports using untyped datasets instead of typed datasets.
View 1 RepliesI wrote a webmethod (Called SearchData()) in which the method makes a httpwebrequest to another url and gets the data in xmldocument. After getting the xmlDocument ,it is returned to SearchData method invoker. When i invoke the from browser it works fine. But When another application in java tries to consume this webmethod SearchData(), it is getting the error
<wsdl:part name="Body"/>
and each part should be type defined. The WSDL file is not well formatted. it doesn't have Type defined at each element. How to fix this.or Is there any other Better way to provide the end user the xml(ie from httpwebrequest result in webmethod ) with a soap wrapper ie with a well defined wsdl. My code :
[Code]....
I have a third party dll and i need to add some more functionalities (methods, constants etc..) so create a wrapper class. I have no idea about wrapper classes. what is the purpose of this and how to create in .NET for this 3rd party dll.
View 6 RepliesI have this CollapsiblePanelExtender (below) the problem is that in firefox it gives a horizontal scroll bar under the control which has to expand.
[Code]....
Below is the generated HTML
[Code]....
If I remove the "overflow-y:hidden" from the generated div then the scroll bar goes away, which is what I want....
I am a REST web service newbie, does visual studio, .NET, or some other nifty microsoft tool provide any easy way to auto generate classes to consume a REST web service? With REST services is there even a service definition like there is with SOAP (WSDL) beyond the printed documentation? There is a new service that I'd like to consume but they only wrote wrappers for PHP, Pearl, Ruby, and Java and have more or less said you are on your own with .NET. I could write it myself but I'd like to cut corners and save time wherever possible.
View 1 RepliesI've seen how to Fake the SessionState object in MVC using Scott Hanselmans MvcMockHelpers, but I'm dealing with a separate problem.What I like to do is create a wrapper around the Session object to make objects a little more accessible and strongly typed rather than using keys all over. Here is basically what it does:
public class SessionVars{ public SessionVars() {} public string CheckoutEmail { get { return Session[checkoutEmailKey] as string; } set { Session[checkoutEmailKey] = value; } }}
So that I can just do this in my controllers and views:
SessionVars s = new SessionVars();s.CheckoutEmail = "test@tester.com";
Now the problem comes in when I want to write unit tests, this class is tightly coupled with the HttpSessionState. What I can't figure out is what is the right class to accept/pass so that I can pass in a FakeHttpSession into the SessionVars class. I've tried so many things with this, and this (below) will compile, but it can't cast the HttpSessionState into the IDictionary. I've tried ICollection, HttpSessionStateBase.
public class SessionVars{ public SessionVars() : this(HttpContext.Current.Session) { } public SessionVars(ICollection session) { Session = (IDictionary<string, object>)session; } public IDictionary<string, object> Session { get; [code]...
I'm missing something big here. I feel like this is possible and that I should even be that far off.Furthermore, I'm confused as to whether I should use the IHttpSessionState, HttpSessionStateBase or the HttpSessionStateWrapper. What is the abstract type that I'd use for the session object inside my SessionVars class? What is the type that I pass into the constructor?
I am just trying to figure something out. At work we have alot of data access code Ex:
[Code]....
Pretty standard stuff really, but I was at a training course recently where the Developers insisted on wrapping code, that seemed nothing more than expose exactly the same functionality.
I was interested in your thoughts as to whether this was a good idea. So the above would inherit from a DbHelper class with some thing like:
[Code]....
These would just expose the same but maybe a bit more generic i.e. using DbCommand as opposed to SqlCommand.
Anybody seen any c# code examples for using Google site search to send a request to the Google search api and return the results in xml?
View 1 RepliesNot sure if I'm posting in the right place so please forgive meI have an ASP.NET C# application that connects to either a SQL Server or MySQL database depending on some value that is set in my project config. The issue I'm trying to avoid is handling the connections and queries separately. Ideally I would want to use a DB Wrapper class that can handle both SQL Server and MySQL.
View 8 RepliesWhen jQuery is applied to elements in an UpdatePanel, when the UpdatePanel refreshes, the jQuery is not applied to the newly injected HTML. This issue is resolved by using
Sys.WebForms.PageRequestManager.getInstance().add_endRequest() to register a function to be called when the AJAX request is complete: I've written a function that registers the function with add_endRequest, and also calls it at the same time:
Async.RegisterAndRun = function(callback) {
//register function to be run when an update panel request is complete
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(callback);
//also run the function right now.
callback();
};
Now all we need to call is Async.RegisterAndRun(AddFancyjQueryToMyHTML); or
Async.RegisterAndRun(function(){
AddFancyjQueryToMyHTML();
AddMoreFancyjQueryToMyHTML('with', 'args');
});
Currently it does what I need it to, and I never need to explicitly call add_endRequest which is nice.
I am using ASP.net with WebMethods to show data to the customer and save data entered by the customer.
My current framework uses javascript to create an xml with all of the values of all the html elements in de "div" (or other element). This xml is converted to a string and send to the webserver using PageMethods.
When I receive this xml (as a string), I parse it with my own XmlDataParser which does some security checks.
I need to parse the xml to an XmlDataParser in every PageMethod I use, and I also need to catch different exceptions (like exceptions that are thrown when data is validated) to show them to the user (=> The reason why is explained in one of my previous posts: [URL]
I wonder if it is possible to write a wrapper around the WebMethod, so I can parse the xml to the XmlDataParser in this wrapper, and pass it on to the code behind, and process exceptions that occur in the code behind?
I'm currently facing a performance problem with creating POCO objects from my database. I'm using Entity Framework 4 as OR-Mapper. The whole application is a prototype for now. Let's assume I want to have some business objects like classes 'Printer' or 'Scanner'. Both classes inherit from a BaseClass called Product.
The business classes exist.
I try to use a more generic database approach. I don't want to create tables for "Printer" nor "Scanner". I want to have 3 tables: One called Product, and the other Property and PropertyValue (which stores all assigned values to a specific Product). In my business layer I do create a specific object like this:
public Printer GetPrinter(int IDProduct)
{
Printer item = new Printer();
// get the product object with EF
// get all PropertyValues
// (with Reflection) foreach property in item.GetType().GetProperties
// {
// property.SetValue("specific value")
// }
return item;
}
This is how the EF model looks like: Works fine so far. For now I'm doing performance tests for retrieving multiple sets. I've created a prototype and improved it several times to increase the performance. It is still far away from being usable. I takes 919ms to create 300 objects who only contain 3 properties. The reason for choosing such DB design is to have a generic database design. Adding new properties should only be done in the business model.
Am I just being too stupid to create a performant way of retrieving xx objects or is my approach totally wrong? As far as I understand OR-Mapper, they are basically doing the same?
Say I have a class that wraps the Controller class:
public class MyController : Controller
{
public string SomeProperty {get;set;}
public override void OnActionExecuting(...)
{
SomeProperty = "hello";
}
}
Now in my site.master, I want to have access to the SomeProperty that I just set. How can I do this?