DataSource Controls :: Data Source Is An Invalid Type Must Be Either An IListSource, IEnumerable, Or IDataSource?
Nov 9, 2010I created one stored procedure.
/*
SP Name :sp_Par_SearchCourseFinder
Author :Mr.Ravichandran
[code]...
I created one stored procedure.
/*
SP Name :sp_Par_SearchCourseFinder
Author :Mr.Ravichandran
[code]...
I having problem binding web service result into a gridview. I using Word Dictionary Web Service for my project. Below is part of my code.
Web References I using is :
[URL]
Protected void Button1_Click(object sender,
EventArgs e) {
DictService ds = new DictService();
ds.DefineAsync(TextBox1.Text);
ds.DefineCompleted += new DefineCompletedEventHandler(ds_DefineCompleted); }
void ds_DefineCompleted(object sender, DefineCompletedEventArgs e){
GridView1.DataSource = e.Result;
GridView1.DataBind();}
The Error i get is : Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource.
I have this error "The given value of type String from the data source cannot be converted to type datetime of the specified target column." when I used sqlbulkcopy to do the transaction
Here is my code:
[code]....
I was looking at the options in Intellisense for the properties used with a parameter for the Object Data Source. There is one that I don't understand how it would be used. explain, or recommend an article, about the DB Type is for and how it would be used?
View 2 RepliesI'm trying to understand when to use the type property and when to use the dbtype property. I looked online but couldn't find a good article that said when and why.
View 3 RepliesI'm trying to create a control out of a class I found, and one of the overridden functions is the following:
protected override void PerformDataBinding(IEnumerable data)
However, when I try to build the control I'm getting the error as shown in the subject. I've tried searching, and it seems the signature for the original function matches the one I have, and all other solutions I've seen uses the same signature.
How do I accept an 'object' as a Datasource (IEnumerable or IList) and loop through the keys/values? I want to be able to pass anything that implements either IEnumerable or IList.
This same functionality exists on all of the .Net DataBound controls and I'm trying to figure out how it's done.
[Code]....
I have a stored procedure written using dynamic SQL in the SQL Server and I am calling it on the code behind and adding parameters to it and filling a dataset and binding the data set to a Gridview. But I am getting this error when I bind it.
Can someone please tell me how to fix this?
It used to work fine when I did not use dynamic sql.
Line 237: da.Fill(ds);Line 238: gviewInvestigations.DataSource = ds;Line 239: gviewInvestigations.DataBind();Line 240: Line 241: }
Source File: s:Cybage2CybageSourceCodeGulfcoastGulfcoastControlsInvestigationsControl.ascx.cs Line:
239
Stack Trace:
[Code]....
[HttpException (0x80004005): The IListSource does not contain any data sources.] System.Web.UI.DataSourceHelper.GetResolvedDataSource(Object dataSource, String dataMember) +8665698 System.Web.UI.WebControls.ReadOnlyDataSource.System.Web.UI.IDataSource.GetView(String viewName) +41 System.Web.UI.WebControls.DataBoundControl.ConnectToDataSourceView() +128 System.Web.UI.WebControls.DataBoundControl.GetData() +4 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +60 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73 System.Web.UI.WebControls.GridView.DataBind() +4 Controls_InvestigationsControl.bindSearch() in s:Cybage2CybageSourceCodeGulfcoastGulfcoastControlsInvestigationsControl.ascx.cs:239 Controls_InvestigationsControl.btnSearch_Click(Object sender, EventArgs e) in s:Cybage2CybageSourceCodeGulfcoastGulfcoastControlsInvestigationsControl.ascx.cs:323 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
I am having trouble converting a ienumerable to a datatabe here is the code:The problem is in the following line-
ViewState("dt") = elements.CopyToDataTable()
Dim dt As New DataTable
Private Sub DisplayAuthorLastName(ByVal strLetter As String)
[code]...
When running the HttpGet action, it works fine. But when I run the HttpPost action, I recieve the error in the title.
Is it because the HttpPost doesn't have a ViewData declared?
[Code]....
I am having a lot of the same issue as this poster did with errors on initializing type.
I am trying to learn linq and am about ready to give up - don't get how this is easier...
I'm trying to do a simple update to product names in the product table based on the manufacturer ID
In order to do this I am looping through each record. I was initally successful with changing all names in the column but when I try to query the data, I continually run into multiple problems.
The following poster has had the same issue I have but his solution isn't working for me.
[URL]
I keep getting the same error on the opening bracket on the select statement in the SelectByManufacturerID function...
Error 1 Cannot initialize type 'DataBaseDataManagement.ProductName' with a collection initializer because it does not implement 'System.Collections.IEnumerable'
Button that does the actual updating...
[Code]....
The function that the button calls to get the query... ERROR
[Code]....
The class located in Query.cs...
[Code]....
IEnumerable<DataRow> query = (from obj1 in objeDC.tmpPolicyRenewals.AsEnumerable()
where obj1.AgentCode == "Admin"
select new
{
obj1.Product,
obj1.PolicyNo,
obj1.Insured,
obj1.EffDate,
obj1.ExpDate,
obj1.GrossPrem,
obj1.Status
}) as IEnumerable<DataRow>;
Getting null value. whats error ?
Here is my code, using LinQ to get the data from database.
public IEnumerable categoryData()
{
db = new DBModelDataContext();
var cat = from c in db.Categories
select new { c.categoryname,c.categoryid };
return cat;
}
trying to get the values (categoryname and categoryid) into textfiled and valuefield of dropdown list.
dt = new clsData();
ddlCategory.DataSource = dt.categoryData();
what is the code that i need to write to assign the categoryname to textfield and categoryid to valuefield. I mean how to loop through the values coming from the above function.
ddlCategory.DataBind();
I want to delete the rows present in the DataTable by using LINQ (with out looping)
The deleted rows will be come from a LINQ as below
IEnumerable<DataRow> MobileQuery = (from d in dtBillDetail.AsEnumerable()
where (String.Compare(d.Field<string>("Destination"), "MOBILE", StringComparison.InvariantCultureIgnoreCase) == 0) select d );
The DataRows present in the "MobileQuery" should be deleted in the DataTable "dtBillDetail"
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.
[Code]....
I am running:
Windows Server 2008
MS SQL Server 2008
MS SQL Server Native Client 2008
I need to create an ODBC Data Name Source. The instructions on microsoft site are not explicit enough.
I have an object data source that is being used by an rdlc report, and the object data source uses a filter that is built from session variables passed to the page.
The report displays correctly, with the filter applied; however, I want to mark each of the rows as "printed" in a bit field in the database table.
In the table adapter, I have the following Update command that is used by the object data source:
UPDATE dbo.WorkOrder
SET boolWorkOrderPrinted = 'True'
WHERE (WorkOrderID = @Original_WorkOrderID)
And in the Page Load event, I run:
ObjectDataSource1.Update();
However, no records are updated.
Iam using DETAILs VIEW TO insert data i have several controls inside Using sql datasouce to insert the data. How can i achieve this?
View 2 RepliesI have a SQLDataSource on an ASP.Net C# page. I want the ability to add a Control Parameter based on a DropDown List that will either display records that are either NULL or Not NULL In a Column. I have the following Code Snippet:
SelectCommand="SELECT [PATID], [LastName], [FirstName], [UIN], [Rate], [Account], [Project], [Supervisor], [HireDate], [Assistantship], [Hourly], [FundingStartDate], [FundingEndDate], [TerminationDate], [Citizenship], [TitleCode], [Email], [Notes],
[SupervisorUpdateEnabled], [SupervisorTargetSemesterCode], [PATCertDate] FROM [PATAccounts] WHERE TerminationDate @Terminated ORDER BY [LastName]"
i am a new user of asp.net and i am a learner so i just want to connect two dropdownlist to data souce and i want that the list item of second dropdown is changed according to change of selected item of first dropdown.
i have connect it to data source successfully it getting chaged items but it happance only when its load then if i select the next item of first one it would not work properly.
I know this sounds odd. I have a SQL DB that I am pulling data from. I have to some math functions to get a percentage. So I am pulling all the data in my code and building a data table with the results. I am then trying to pass this into a chart control that I have, but it fails because the data source is not correct for the chart control. I know that the chart control will accept a SQLDataSource control as a data source because a built a example with it before using it in my project.So my question is how can I use the Data Table as a data source for a SQLDataSource Control? Or is there a way I can pull the data from my DB andapply the math needed in a stored procedure or something similar that I could create the procedure on my SQL server then add a SQLDataSource control to my page and use the stored procedure as the source for the SQLDataSource Control.
View 5 Repliesmy query is SELECT a.HD, a.HEAD, a.SH, a.SUBHEAD, a.TRK, a.TRACK, a.TGT, a.TARGET, a.PDC, a.DT_RELEASE, a.STATUS, a.CO
FROM V_HIERARCHY1 a
my data is ,HR HR Rec Records Leave Leave Records HRL.0001 Policy and Process for leave record. 27.06.2010 30.06.2010 WIP Edlink
HR HR Rec Records Leave Leave Records HRL.0002 Quarterly Review 01.07.2010 04.07.2010 Planned Edlink
HR HR DB Database SAL Salary DDS.0001 Calculation of Monthly salary 08.08.2010 09.08.2010 WIP Edlink
HR HR Rec Records Ind Induction Records HRI.0001 Completion of dossiers. 08.07.2010 10.07.2010 WIP Edlink
HR HR DB Database Emp Employee HDE.0001 Offer letter 06.07.2010 09.07.2010 WIP Edlink
my outout is ,HR
REC
LEAVE
HR1
REC1
LEAVE1
i had a requirement for dynamic sorting so i wanted to assign order by.. dynamically depending on what column is clicked for sorting
i tried to modify the sql data source command
in ds selecting event by using
e.command.CommandText=modifiedCommandHere; but it doesnt work as it always picks up selectCommand specified in aspx page
I'm new to this community and got newbie question, briefly in data access in asp.net what is the difference between accessing dataset using typed Dataset and using data sources controls like SQL data source control ...? As I noticed that using data source controls is much easier, but it allows only one data access method i.e. only one query... am I right with that....
View 1 RepliesI have an insert that uses an object data source with out the direction property set and it works fine. I noticed the direction property though and wondered if I should use it.Should the direction property for the parameters of an object data source be used with a simple CRUD operations?
View 3 Replies