|
Hello,
I am having an issue returning results to a GridView. After running an Sql Query for the MS SQL 2005 database, I get the following error.
{"A field or property with the name 'Site_Number' was not found on the selected data source."}
The program continues and simply does not post to the grid. A STOP fault check indicates that 4 results were returned for this query and the error happens on the last line of the code below:
[GridViewAeSummary.DataBind()]
Here is the code:
<br />
Comm.Parameters.Clear();<br />
Comm.Parameters.AddWithValue("@Site_Number", selectedSite);<br />
<br />
SqlDataAdapter da = new SqlDataAdapter(Comm);<br />
da.Fill(ds);<br />
<br />
int thisTotal = ds.Tables[0].Rows.Count;<br />
count = count + thisTotal;<br />
<br />
if (count < 1)
{<br />
title = "0 Results Returned";<br />
message = "There are no AE's at this site!";<br />
Session["message"] = message;<br />
Session["title"] = title;<br />
Response.Redirect("MessageBox.aspx");<br />
Session.Remove(message);<br />
Session.Remove(title);<br />
return;<br />
}<br />
<br />
GridViewAeSummary.DataSource = ds.Tables[0].DefaultView;<br />
GridViewAeSummary.DataBind();<br />
<br />
}<br />
catch (Exception ex)
{<br />
Console.WriteLine("Error : " + ex.Message);<br />
}<br />
If I run the query using the query tool in Sql 2005, it returns perfectly. I have never seen this error before. Obviously, if the column was not in the data source, it would not return a value to 'count', nor would it work as a database query. I'm confused. Any ideas?
Thank you in advance.
Best Regards, Pat
|
|
|
|
|
Gentleman:
I have resolved the issue. For those who are interested, I was calling the query and using a column in the WHERE statement that was not in the query itself. I seem to recall being able to do this with MS SQL 2000 but apparently it cannot be done with 2005. I simply added the "WHERE" variable column to the query and all is well. Hope this post helps someone else. Pat
|
|
|
|
|
Hi.
currently i m using asp.net 2005 (2.0 framework).
i have created 3 themes and i let the user to change the theme (using dropdownbox). below code i have used.
const string _themeListIDKey = "_themeListIDKey";
protected void Page_PreInit(object sender, EventArgs e)
{
if (IsPostBack)
{
string uniqueID = Request[_themeListIDKey];
if (uniqueID != null && Request[uniqueID] != null)
{
Theme = Request[uniqueID];
Session["SelectedTheme"] = Theme;
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
ClientScript.RegisterHiddenField(_themeListIDKey, ((DropDownList)(this.Master.FindControl("DropDownList1"))).UniqueID);
}
but when i create a skin for gridview onload its not working. when i change another theme and again i come to the current there through dropdown, then only its applying. help me plz.... - Karan
|
|
|
|
|
Karan_TN wrote: when i create a skin for gridview onload its not working
Do you mean Page_Load or onload in the client ?
Show the code that fails.
|
|
|
|
|
|
const string _themeListIDKey = "_themeListIDKey";
protected void Page_PreInit(object sender, EventArgs e)
{
if (IsPostBack)
{
string uniqueID = Request[_themeListIDKey];
if (uniqueID != null && Request[uniqueID] != null)
{
Theme = Request[uniqueID];
Session["SelectedTheme"] = Theme;
}
}else{
Session["SelectedTheme"] = This is where you put the desired initial theme;
}
}
|
|
|
|
|
Where did you applied the Themes in page ??
Cheers !
Abhijit Jana | MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
i applied this coding in all pages. and the dropdown control is in master page (content area)
|
|
|
|
|
Karan_TN wrote: i applied this coding in all pages
Where did you used Page.Theme = currentTheme ??
Don't Apply the theme to all pages. Try to use HTTPHanlder for do the job automatically for you.
Cheers !
Abhijit Jana | MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hi Karan_TN,
I am preparing a tutorial to apply themes dynamically with master pages.
You can have a look at it i'll let u know once its posted.
Tej Aj,
http://opexsolution.com/forum/[^]
|
|
|
|
|
|
Hi,
If i try to start an Asp.NET page by clicking the shortcut 'view in browser' it opens IE but it shuts it down instantly again.
What am I missing?
Thanks in advance!
|
|
|
|
|
You means shortcut of web application ? You need to give only URL property for that shortcut. No need to do anything else.
Or you want something else ?
Cheers !
Abhijit Jana | MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
hello,
i have developed my own content management system. it consists SEO friendly features. one of that is adding meta keywords.
but the problem is i am unable to call relevant keyword set when a product is clicked. is it possible to call keywords to page header using click event?
and also, pls, tell me if there exist another way without using page_Load event
|
|
|
|
|
Which Framework of .NET are you using ?
Cheers !
Abhijit Jana | MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
|
hello everyone
I would like to know how to link layers (objects, dal and bll) between them, for example, I would add a new record in my table so I created a class that contains the constructors and properties, a class that contains DAL methods of access to data and a class containing functions BLL insertion data in the database .my problem is that I do not know how to tie all these component-level code.
thanks.
|
|
|
|
|
Have you tried this[^]?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
Thank you for your answers, but in my project I created 4 layers, DAL, busniss object, BLL and presentation layer, so my problem was that I could aps linked layer busniss object (which contains the methods get and set) with the BLL and DAL , I searched but I don't found the concrete examples
|
|
|
|
|
ok But why do you have two BLL ?
What is the Sequence here please choose one and we will continue and i will tell you what to do
PL-->BLL--->Business objects---->DAL
or
PL-->Business objects--->BLL---->DAL
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I work with this method
PL-->Business objects--->BLL---->DAL
|
|
|
|
|
Ok now Remove all the references to the Projects.
let us start from the Back the DAL.
DAL The DAL must not reference any Project, if you have a reference to any project then remove it
BLL Add a Reference of DAL in the this Project(Only the Reference to DAL must exists)
Business objects Add the Reference to BLL(Only the Reference to BLL must Exists)
PL Add a Reference to the Business objects(Only the Reference to the Business objects must exist)
Note: if you want to add a Reference Right Click the Individual not a Solution but a Class Library and select the "Add References" option and a dialogbox will appear, Click on the "Project Tab" and select the appropriate project.
Hope you understand this
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
yes I understand , and thank you for your help Vuyiswa Maseko
|
|
|
|
|
You welcome
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|