PC Review


Reply
Thread Tools Rate Thread

Datalist DataSource Error

 
 
Will Chamberlain
Guest
Posts: n/a
 
      1st Dec 2005
I am currently converting some VB.NET web apps to C#. It has been pretty
seamless so far but have currently run into some problems that I can't
resolve. The line that generates the error is:

The specific error is:

CS1502: The best overloaded method match for
'_Default.PopulateDrawingList(string)' has some invalid arguments

This is what is highlighted:

<aspataList ID="dlSheetType" cssclass="datalist1" DataSource='<%#
PopulateDrawingList(DataBinder.Eval(Container.DataItem,
"DrawingNumber")) %>' Runat="server">

The function referenced is:

public DataSet PopulateDrawingList(string DrawingNumber)
{
string strSQL = "SELECT Drawing, DCN, SheetNumber, SheetType, ADCN FROM
vwAllLatestrevSheetsWithADCN WHERE (Drawing = '" + DrawingNumber + "')
AND (State = 8) ORDER BY SheetType, SheetNumber, DCN, ADCN";

Dataset ds = new DataSet();
OleDbDataAdapter cm = new OleDbDataAdapter(strSQL, objConnSQL);
cm.Fill(ds, "DataTable");
ds.Tables["DataTable"].Columns.Add("NewADCN");
int dsRowCount = ds.Tables[0].Rows.Count;

for (int i=0; i <= dsRowCount; i++)
{
if (ds.Tables["DataTable"].Rows[i]["ADCN"] is DBNull)
{ds.Tables["DataTable"].Rows[i]["NewADCN"] = "&nbsp;";}
else
{ds.Tables["DataTable"].Rows[i]["NewADCN"] =
ds.Tables["DataTable"].Rows[i]["ADCN"];}
}
return ds.Tables[0];
}

Any suggestions as to where I can look to correct this problem?


*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
Will Chamberlain
Guest
Posts: n/a
 
      1st Dec 2005
So I'm on the right track I believe. My error is now residing:
<aspataList ID="dlSheetType" cssclass="datalist1" DataSource='<%#
PopulateDrawingList(Container.DataItem("DrawingNumber")) %>'
Runat="server">

The exact error I get now is:
CS0118: 'System.Web.UI.WebControls.DataGridItem.DataItem' is a
'property' but is used like a 'method'

The source code:

DataSet ds = new DataSet();
OleDbDataAdapter cm = new OleDbDataAdapter(strSQL, objConnSQL);

cm.Fill(ds, "DataTable");
ds.Tables["DataTable"].Columns.Add("NewADCN");

int dsRowCount = ds.Tables[0].Rows.Count;

for (int i=0; i < dsRowCount; i++)
{
if (ds.Tables[0].Rows[i]["ADCN"] is DBNull)
{ds.Tables[0].Rows[i]["NewADCN"] =
Convert.ToInt32(ds.Tables[0].Rows[i]["ADCN"]);}
else
{ds.Tables[0].Rows[i]["NewADCN"] = "&nbsp;";}
}
return ds;

I am from a VB background and am seeing errors now that I have never
seen before. I am setting the function above as the datasource for a
datalist nested inside of a datagrid. When I do this in VB.NET it works
flawlessly. Any suggestions?

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
Will Chamberlain
Guest
Posts: n/a
 
      1st Dec 2005
Nevermind folks!

<%# PopulateDrawingList((string)DataBinder.Eval(Container.DataItem,
"DrawingNumber")) %>



*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datalist DataSource Error Will Chamberlain Microsoft C# .NET 1 5th Dec 2005 03:08 PM
Setting up a datalist control - Item_DataBound for a datalist in a datalist Nevyn Twyll Microsoft ASP .NET 8 9th Sep 2004 11:13 PM
Datalist: update a datasource without using select/edit/update Hartmut Schroth Microsoft ASP .NET 3 1st Dec 2003 10:54 AM
ComboBox.DataSource .Net v1.1.4322: Problem to assign new datasource Stephan Microsoft Dot NET Framework 3 10th Oct 2003 08:09 AM
cast datagrid.datasource to dataset (datasource is table) newsgroper@yahoo.com Microsoft Dot NET Framework Forms 1 4th Jul 2003 04:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:52 AM.