Can not find TypeName of ObjectDataSource

V

vncntj

I have this class file within the App_Code folder
CorrectionsDB.cs

namespace CorrectionsDB.cs
{

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;

/// <summary>
/// Summary description for CorrectionsDB
/// </summary>
public class CorrectionsDB
{
public CorrectionsDB() { }

public static System.Data.DataSet GetCampaign()
{
string connectionString =
ConfigurationManager.ConnectionStrings["Development"].ConnectionString;
System.Data.IDbConnection dbConnection = new
System.Data.SqlClient.SqlConnection(connectionString);
string queryString = "Select Campaign from tCampaigns Order
By Campaign";
System.Data.IDbCommand dbCommand = new
System.Data.SqlClient.SqlCommand();

dbCommand.CommandText = queryString;
dbCommand.Connection = dbConnection;

System.Data.IDbDataAdapter dataAdapter = new
System.Data.SqlClient.SqlDataAdapter();

dataAdapter.SelectCommand = dbCommand;

System.Data.DataSet dataSet = new System.Data.DataSet();

dataAdapter.Fill(dataAdapter);
return dataSet;
}
}
}

..... and this .aspx file

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="gift.aspx.cs"
Inherits="gift" %>
<%@ Register TagPrefix="CorrectionsDB" Namespace="CorrectionsDB.cs"
Assembly="App_Code/CorrectionsDB.cs" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<tr>
<td style="width: 170px">Campaign</td>
<td width="230">
<asp:DropDownList ID="DropDownnList1" runat="Server"
DataSourceID="ObjectDataSource1" DataTextField="campaign"
DataValueField="campaign" />
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
TypeName="CorrectionsDB" SelectMethod="GetCampaign" />
</td>
<td width="170">Campaign</td>
<td width="230">


</td>
</tr>
 
V

vncntj

thanks! I think that worked, but I'm now getting a "Parser Error"..

"Could not load file or assembly 'CorrectionsDB.cs' or one of its
dependencies. The system cannot find the file specified"

in reading many of the post on google, it seems as though this is a
system issue rather than a programming one. Are you familiar with such
a problem.


regards,
v
The type name is the namespace +the class name, or in this case,

CorrectionsDB.cs.CorrectionsDB

Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




I have this class file within the App_Code folder
CorrectionsDB.cs

namespace CorrectionsDB.cs
{

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;

/// <summary>
/// Summary description for CorrectionsDB
/// </summary>
public class CorrectionsDB
{
public CorrectionsDB() { }

public static System.Data.DataSet GetCampaign()
{
string connectionString =
ConfigurationManager.ConnectionStrings["Development"].ConnectionString;
System.Data.IDbConnection dbConnection = new
System.Data.SqlClient.SqlConnection(connectionString);
string queryString = "Select Campaign from tCampaigns Order
By Campaign";
System.Data.IDbCommand dbCommand = new
System.Data.SqlClient.SqlCommand();

dbCommand.CommandText = queryString;
dbCommand.Connection = dbConnection;

System.Data.IDbDataAdapter dataAdapter = new
System.Data.SqlClient.SqlDataAdapter();

dataAdapter.SelectCommand = dbCommand;

System.Data.DataSet dataSet = new System.Data.DataSet();

dataAdapter.Fill(dataAdapter);
return dataSet;
}
}
}

..... and this .aspx file

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="gift.aspx.cs"
Inherits="gift" %>
<%@ Register TagPrefix="CorrectionsDB" Namespace="CorrectionsDB.cs"
Assembly="App_Code/CorrectionsDB.cs" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<tr>
<td style="width: 170px">Campaign</td>
<td width="230">
<asp:DropDownList ID="DropDownnList1" runat="Server"
DataSourceID="ObjectDataSource1" DataTextField="campaign"
DataValueField="campaign" />
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
TypeName="CorrectionsDB" SelectMethod="GetCampaign" />
</td>
<td width="170">Campaign</td>
<td width="230">


</td>
</tr>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top