Need ideas on how to do this. I have a page where I'm adding a new object.This is a row in a db table. This object has a list of other objects associated with it.I want to be able to define the sub-objects before adding the new object. Does that even make sense??
I was thinking somehow using the object datasource would be a good way to manage this. That way when I add the object, just loop through the object datasource to get the sub-objects to add. How would I achieve this with the object datasource, or am I even going about it the right way?
My lecturer insists that a web site should NOT have a static SQL connection as its not good practice (didn't explain why) but then I thought that if one makes instances of an SQL connection everytime I want to save, delete or edit then surely thats a bottleneck as I would need to everytime establish a connection and then do the save process. From what I have read online, the process of establishing a connection to the server is the longest (about 5 to 10ms)...
How would one manage their SQL connection. At the moment I do something like:
I restored a database from another server, and everything looks good except the users.
I'm managing all this from SQL Server 2008 Management Studio as SA.
The users are present in the [u]databaseName > security > users[/u] section, and they exist in [u]databaseServer > Security > Logins[/u]. However I can't change anything in the [u]databaseName > security > users[/u] section, because when I try and make a change, and then I hit OK to apply, it says "[i]login name must be specified[b][/b][/i]". But the login name field is grayed out and I can't modify it(even though I'm logged into the machine as Administrator and SQL as SA).
Also, in the user mapping section, when I try to map one of the users to a database, it says '[i]create failed user already exists[b][/b][/i]'...but I don't want to create the user, I just want to map that user to the appropriate databases...
i have problem white Object datasource. i have a multi-tier Application that include common layer ,DAL Layer,business logic and persantation layerwhen i add a object datasource to my page, it bring me only common layer classes . but i want use bisuiness layer classes what do i do ?
I am storing a custom "Organisation" object as a session variable. One of the properties of the Organisation object is "OrganisationID" (integer). I have a DataSource that requires a parameter value to run, and I want to use a SessionParameter to populate this. In a previous version, I stored the OrganisationID directly as a session variable. In that case, I could easily access it like this:
[Code]....
However, how do I now access the OrganisationID property of an "Organisation" type session variable (called "Organisation")? I have tried this, which does not seem to work: <asp:SessionParameter Name="OrganisationID" SessionField="Organisation.OrganisationID" Type="Int32" />
This is the first time I have been working on databases and I am trying to insert data using an object datasource but no data is being inserted and no exception is thrown. I'm not sure where I am going to wrong. I am putting user data into session variables and inserting the session variables into the dataacess class layer and have a try and exception but nothing being thrown. Any help would be really appreciated because I don't know even where to start looking with this or how I can get the error to be thrown. Please see some of my code below to give an idea of what I am doing
Object Access Class public void InsertCarPolicyHolder(PolicyHolderClass ph, CarInsuranceOptions options) {
I have a Public Sub listed in a class file that I am using to store Select, Update,etc...methods for an Object Datasource. When I attempt to configure the datasource, the Class appears as a business object, but the sub within the class is not available for method selection. (It does not appear in drop down list in wizard.)
The sub exists, so where is a good place for me to start looking for a fix? I have part of the class file listed below:
Traditionally with an Object Data Source, the wired up class will have its public properties available for binding (i.e. Gridview columns, etc.) which works well. But what if one of my wired up business objects has a property that is an object itself; can I drill down to a property on that object property and still use it?
So in additiona to the traditional:MyBusniessObject.OrderID...I want to use:MyBusniessObject.Customer.NameID Your 1st response might be to just wire up the 'Customer' class, but I need properties both on 'MyBusinessObject'and 'Customer'. I do not think this can be done, as the ODS will not display properties on an object instance property. I have tried manually typing in the drilled down value as well, but that wasn't a success either.
I'm getting the old "Object reference not set to an instance of an object" error on this code:
nonqueryCommand.Parameters.Add("@comment", SqlDbType.VarChar, 500) nonqueryCommand.Parameters("@comment").Value = CType(FormView1.Row.FindControl("CommentsLabel"), TextBox).Text "CommentsLabel" is a textbox, despite it's name (and I've tried the CTYPE ot Label too).
have an object datasource that calls a web method to retrieve a set of data. That web service resides on another remote server with Windows Authentication enforced. How do I pass in the credentials required for the authentication from my web application? My code is as follows:
I have a SQL Datasource populating a Drop Down List with Company Names. The Select Statement the Datasource uses selects Company ID and Company Name.When a company is selected from the list, there is a button on the page to continue processing with the selected company. On the press of the button, I want to set a session variable for the Company ID of the Company selected. This Company ID is obviously held in the Datasouce. Any idea how I get at the Company ID.My code will look like the following:Session.AddsessCompanyID", ????????????)where ?????????? represents the source of the Company ID.
I am trying to get an idea on the best way to do the following:
[1]I have a list of object type (my_object_type), one of the my_object_type members is called SortOrder, which corresponds to the location within the list.
[2]I bind this List<my_object_type> to a GridView, that looks something like the following when displayed:
[1]|[something]|[something]|MOVE TO [DropDownList 1-6]|[Move Button] [2]|[something]|[something]|MOVE TO [DropDownList 1-6]|[Move Button] [3]|[something]|[something]|MOVE TO [DropDownList 1-6]|[Move Button] [4]|[something]|[something]|MOVE TO [DropDownList 1-6]|[Move Button] [5]|[something]|[something]|MOVE TO [DropDownList 1-6]|[Move Button] [6]|[something]|[something]|MOVE TO [DropDownList 1-6]|[Move Button]
[3]When I select a drop down list item from column 4 of the GridView and then select the MOVE BUTTON, I would like to be able to move an object to a specific NEW location - basically reorder the List<my_object_type> and then BIND the new List Order back to the GridView.... (example: current list item #3 -> select #5 from drop down list -> press Move Button ||| then BIND changes back to the GridView)
Question: any recommendations about the best way of doing this within the gridview, etc...?
I am declaring a list in my class, populating the list in page load and using the list in various methods in this class. But, I get this error at every instance where I use this list in the methods. Error: System.NullReferenceException: Object reference not set to an instance of an object.
I am developing on application in that i have taken one list box and getting data to it using an object source.up to this stage it is fine.I need to compare these value what i get into list box and need to represent data in to a report viewer ..how to get these values from objectsource.i m new to c# i placing the code.
I am trying to get an asp:SessionParameter of a SelectParameters, to use a property of an object in session instead of having a string in the session like Session["CustomerID"]
Something like Session["Customer"] where the property is ((Customer) Session["Customer"]).CustomerID)
My code:
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:DBConnectionString %>" xmlns:asp="#unknown"> SelectCommand="SELECT * FROM getStoreCustomers (@customerID,@week,@day)" ProviderName="System.Data.SqlClient"> <selectparameters> <asp:sessionparameter name="customerID" sessionfield="Customer" /> ?????? (what is the syntax to pass the property here?) <asp:controlparameter controlid="ddWeek" defaultvalue="-1" name="week" propertyname="SelectedValue" /> <asp:controlparameter controlid="ddDay" defaultvalue="-1" name="day" propertyname="SelectedValue" /> </selectparameters>
The class I use is like any other class (but serializable)
[Serializable] public class Customer { public int CustomerID { get; set; } }
USE [fedach] GO /****** Object: UserDefinedFunction [dbo].[pages_Allowed] Script Date: 05/18/2010 14:14:34 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE FUNCTION [dbo].[pages_Allowed] (@username varchar(35)) RETURNS varchar(30) AS BEGIN -- Declare the return variable here DECLARE @pages varchar(30) DECLARE @PRvalidate tinyint,@PRdownload tinyint,@PRupload tinyint, @Pages as varchar(35) select @PRvalidate=Rvalidate,@PRdownload=Rdownload,@PRupload=Rupload from tblPermittedpages where Username=@username; select @Pages = case when @PRvalidate=1 and @PRdownload=1 and @PRupload=1 then 'Admin' when @PRvalidate=1 and @PRdownload=0 and @PRupload=0 then 'Validate Only' when @PRvalidate=0 and @PRdownload=1 and @PRupload=0 then 'Download Only' when @PRvalidate=1 and @PRdownload=0 and @PRupload=0 then 'Validate and Download' End; return @pages END
But when i am running the function i am getting the error as Invalid object name 'dbo.pages_Allowed'. can any one tell why?
I have a table into the database. Table name is NewResults. I have created instance of NewResult called result and fill it with all the infos i need. Now when I try to add i dont have add method in
context.NewResults. -> no Add here. So if i enter context.NewResults.Add(result) error as below is shown:
Error 1 'System.Data.Linq.Table<UDWAutoLinqTry.LinqToSql.NewResult>' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'System.Data.Linq.Table<UDWAutoLinqTry.LinqToSql.NewResult>' could be found (are you missing a using directive or an assembly reference?) C:Documents and SettingsAlek.NikolovskiMy DocumentsVisual Studio 2008ProjectsUDWAutoLinqTryUDWAutoLinqTryCompareCompareHelper.cs 332 32 UDWAutoLinqTry
what am i missing?
I know that i dont have to create add method myself i was googling and i am doing everything as it should but still no luck?