Member_4438002
asked on
ObjectDataSource Wizard doesn't detect Class files in App_Code
Hi,
I'm trying to set up a web site with Class files in the App_Code directory. When using the ObjectDataWizard configuration set up wizard, the first screen reads "Select your business object"
The dropdown only contains references to my master page files, no sign of the .cs files I have created
I'm trying to set up a web site with Class files in the App_Code directory. When using the ObjectDataWizard configuration set up wizard, the first screen reads "Select your business object"
The dropdown only contains references to my master page files, no sign of the .cs files I have created
ASKER
Thanks for the quick response.
I don't think I have. Would I do this in the CS file? I'm new to .net, so I've added the class file I'm trying to use
I don't think I have. Would I do this in the CS file? I'm new to .net, so I've added the class file I'm trying to use
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Data.SqlClient;
/// <summary>
/// Summary description for TimePlanData
/// </summary>
///
public class TimePlanData
{
private string _conString;
public TimePlanData()
{
_conString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
}
public IList<TimePlan> GetTimePlans(int idFilter)
{
string sql = "SELECT * FROM TimePlan ";
if (idFilter > 0)
{
sql += "where tp_id=" + idFilter;
}
sql += " order by tp_name";
SqlConnection connection = null;
IDataReader reader = null;
IList<TimePlan> result = new List<TimePlan>();
try
{
connection = new SqlConnection(_conString);
connection.Open();
IDbCommand cmd = connection.CreateCommand();
cmd.CommandText = sql;
reader = cmd.ExecuteReader();
while (reader.Read())
{
result.Add(new TimePlan(reader));
}
}
catch (Exception ex)
{
}
finally
{
if (reader != null)
reader.Close();
if (connection != null)
connection.Close();
}
return result;
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent, thanks!
I take it for every other method I add, for example an Insert method, I put the line:
[DataObjectMethodAttribute (DataObjec tMethodTyp e.Insert, true)]
before it?
I take it for every other method I add, for example an Insert method, I put the line:
[DataObjectMethodAttribute
before it?
Hi,
Yes, exactly.
/Carl.
Yes, exactly.
/Carl.
ASKER
Hi,
I'm trying to add an Insert routine to this class file, but the ObjectDataSource wizard is only detecting the "GetData" method
It is not showing the "AddData" method, and when I type in "[DataObjectMethodAttribut e" this is not detected in the intelisense
I'm trying to add an Insert routine to this class file, but the ObjectDataSource wizard is only detecting the "GetData" method
It is not showing the "AddData" method, and when I type in "[DataObjectMethodAttribut
[DataObjectMethodAttribute(DataObjectMethodType.Insert, true)]
public void AddData()
{
}
[DataObjectMethodAttribute(DataObjectMethodType.Select, true)]
public IList<Data999> GetData(string telNumber)
{
Have You specified the component model attributes in your class files? I.e:
[System.ComponentModel.Dat
public partial class MyDataAccess {
[System.ComponentModel.Dat
public static DataSet GetMyData() {
}
}
/Carl.