|
The Error is : Characters found after end of SQL statement.
I want to the two tables separately in my dataset.
How to do so?
VanithaVasu
|
|
|
|
|
What is it that you are after?
If you want more than two select statements in the table use a join.
If you want different select statements for different tables or adapters,
use different querystrings...
I think for ur case u need :
DataTable dt1=new DataTable();
DataTable dt2=new DataTable();
dt1="first sql select query result";
dt2="second sql select query result";
dataset ds=new dataset();
ds.Tables.Add(dt1);
ds.Tables.Add(dt2);
Hope that helps!!!
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|
|
Insetd of trying this:
DataAdapter=new OleDbDataAdapter("select * from Table1;select * from Table2",connection);
Try this:
SqlDataAdapter adpt1 = new SqlDataAdapter("Select * From Table1", con);
DataSet ds = new DataSet();
adpt1.Fill(ds);
SqlDataAdapter adpt2 = new SqlDataAdapter("Select * From Table2", con);
adpt2.Fill(ds);
return ds;
Naresh Patel
|
|
|
|
|
VanithaVasu wrote: I want to the two tables separately in my dataset.
How to do so?
As I told before, stored procedure's would be better approach for your problem. Write a stored procedure like
CREATE PROCEDURE [dbo].[MultipleSelect]
AS
SELECT * FROM FisrtTable
SELECT * FROM SecondTable
GO
Now Set command type to stored procedures for your OleDbCommand. Pass this stored procedures and fill dataset. This will give you two tables in dataset. Returning multiple recordset is a recommended practice by MSDN, which boosts performance.
|
|
|
|
|
Hi all,
I am publishing my web site by right clicking the solution - publish -
In the out put bin folder there exists around 600 files around 200 Dll's and 400 .compiled files. I dont know where these came from. Am i doing the publish right or not? By the way my application is working ok. Another question also is that if i need to change some thing do i need to upload all the bin folder again?
Thanks
|
|
|
|
|
Hello all,
I need an application which can read a given pdf (with multiple pages)and break it into multiple files on a given parameter.
The first objective is to develop and application which can read the whole pdf word by word into a stream, and writing the same stream into another pdf.
If someone has done any work on that, then please share the same or any apropos information.
|
|
|
|
|
hi all,
I want to update the body of my web page say every 10 seconds without having to reload the page i.e. no flickers. I just want any part of the page that has changed e.g. a table connected to a database to show the current data without the users clicking anything i.e. it should be automatic, using a particular time interval like I mentioned.
i tried using the setInterval('function1()',10000) and the page gets reloaded.but i want to avoid this.How can i implement the same using AJAX?
Thanks in advance.
Regards
Anuradha
|
|
|
|
|
If you want to do it using AJAX then grab the framework from ajax.asp.net. Then you just have to drop an updatepanel around what you want to update and a timer to trigger it.
|
|
|
|
|
hi mark,
thanks for your reply. I thought using ajax will stop refreshing the page.Can i implement the same without using ajax? if it is possible,
can you please help me with some samples?
Thanks again
Regards
Anuradha
|
|
|
|
|
With ASP.NET Ajax extension, there are two important controls called "Update Panel" and "Timer".
1. Add the UpdatePanel control to your page.
2. Add Timer control (this control from Ajax extension. not windows timer.)
3. In Tick event of timer, do the updating your page.
I saw like that one in ASP.NET Forum.
Check-out this.
http://forums.asp.net/p/1118294/1740340.aspx
Hope it helps.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
anu81 wrote: Can i implement the same without using ajax? if it is possible,
You can put the items that needs to be refreshed in seperate frame (IFrame) and reload the frame using javascript.
|
|
|
|
|
Use atlas framework and use ajax enabled controls like UpdatePanel
Sarith...
|
|
|
|
|
Hi,
I am having a really wierd problem. My page change event does not fire for my first page. Whenever i click on page 1 from any page the page change event does not fire. But when i click on other pages the event is fired properly.
Following is the code.
Since i am generating the Bound columns dynamically i am calling the getdata() method in OnInit in order to avoid
eventvalidation problem.
public partial class User_Control_Generic_Grid_ctlGenDGSelecttest : System.Web.UI.UserControl
{
string ReportDetails = string.Empty;
protected string MyData
{
get { return Request.Form[getClientName(this.txtRptDetails)]; }
set { txtRptDetails.Text = value; }
}
String getClientName(Control ctrl)
{
String result = ctrl.ClientID.Replace("_", "$");
return (result);
}
protected override void OnInit(EventArgs e)
{
if (IsPostBack)
{
getdata();
}
}
protected void Page_Load(object s, EventArgs e)
{
if (!IsPostBack)
{
string ReportParams = (string)Context.Items[ReportConstants.ReportParams];
//Setting DataKeyField Value
string ReportName = string.Empty;
string[] rptDetails = ReportParams.Split('|');
int ParamCount = (ReportParams.Split('|').Length) - 1;
for (int i = 0; i <= ParamCount; i++)
{
string[] ParamsRpt = rptDetails[i].Split('=');
if (ParamsRpt[0] == ReportConstants.ReportName)
{
ReportName = ParamsRpt[1];
}
}
SqlConnection conSQL = new SqlConnection("server=test;uid=sa;pwd=password;database=northwind");
SqlCommand cmdSelect = new SqlCommand("WebGetReportDetails", conSQL);
cmdSelect.CommandType = CommandType.StoredProcedure;
cmdSelect.Parameters.Add(new SqlParameter("@ReportName", ReportName));
DataSet dstProducts = new DataSet();
SqlDataAdapter aptrProducts = new SqlDataAdapter(cmdSelect);
aptrProducts.Fill(dstProducts);
txtRptDetails.Text = ReportParams;
ReportDetails = ReportParams;
getdata();
}
}
public virtual void PageIndexChanged_GridView(object s, DataGridPageChangedEventArgs e)
{
DataGrid gv = (DataGrid)s;
gv.CurrentPageIndex = e.NewPageIndex;
getdata();
}
public void getdata()
{
DataSet ds = new DataSet();
string rptDetailstxt = this.MyData;
if (rptDetailstxt == null)
{
rptDetailstxt = txtRptDetails.Text;
}
GridReports objBO = new GridReports();
ds = (DataSet)objBO.GridData(rptDetailstxt);
foreach (DataColumn c in ds.Tables[0].Columns)
{
grdvwCheckbox.Columns.Add(CreateBoundColumns(c));
}
grdvwCheckbox.DataSource = ds;
grdvwCheckbox.DataBind();
}
public BoundColumn CreateBoundColumns(DataColumn c)
{
BoundColumn column = new BoundColumn();
column.DataField = c.ColumnName;
column.HeaderText = c.ColumnName.Replace("_", " ");
column.DataFormatString = setFormating(c);
column.ItemStyle.Wrap = false;
return column;
}
private string setFormating(DataColumn bc)
{
string dataType = null;
switch (bc.DataType.ToString())
{
case "System.Int32":
dataType = "{0:#,###}";
break;
case "System.Decimal":
dataType = "{0:c}";
break;
case "System.DateTime":
dataType = "{0:dd-mm-yyyy}";
break;
case "System.String":
dataType = "";
break;
default: dataType = "";
break;
}
return dataType;
}
}
Please feel free to revert in case of any clarification.
Thanks!
Regards,
Anees
|
|
|
|
|
Page_Init is for only initialisation purpose. We have to initalise the components which should be displayed on page_Load.
I have initalised all the components used in the page load. But i dont know how to proceed.
Since i am also having the same problem,if you got the solution please give the solution which will me very useful for me.
VanithaVasu
|
|
|
|
|
VanithaVasu wrote: Page_Init is for only initialisation purpose. We have to initalise the components which should be displayed on page_Load.
If your controls are dynamically created and you want to persist the value on postbacks, you need to create it on Init event. Then only ASP.NET will maintain viewstate for that.
|
|
|
|
|
Anees Mitha wrote: Whenever i click on page 1 from any page the page change event does not fire. But when i click on other pages the event is fired properly.
What is page change event ? I have not heard anything like that. Please make your question more clear.
|
|
|
|
|
Sorry its PageIndexChanged event.
|
|
|
|
|
Hi,
I got the solution. Not sure how it worked but when i changed enableviewstate from True to False, every thing is working properly.
Thanks for all the help.
Regards,
Anees
|
|
|
|
|
Please help me by sending the sample codes of how to convert html(Usually a normal html page in the current project) to xml and store it in sqlserver2005 as xmldatatype and then convert back to html as a different page when clicking a button.
|
|
|
|
|
|
I tried that link, But didnt help me , mainly because my html page lies within my project, but in the link the method given is using html pages of some other domain. But thx for the reply
|
|
|
|
|
You would need to download the project and check out some of the samples to confirm, but i believe that you can easily create an xml document from just a string (i.e. read the contents of your file into a string) containing html.
|
|
|
|
|
Yes, I have tried downloading those files.But there is no option for adding files from working project, it requires other webpages with IP addrss.
|
|
|
|
|
Hi,
I am developing a Web application in ASP.NET 2.0 and having a "Signout" hyperlink on my top user control. When a logged user clicks on signout I simply clears all sessions and redirect user to my login page. The problem is that the user can still view the last page by using browser's back button. At this moment the page doesn't reload bcoz it is already in browser's cache. I just want to disable this back button (I know that this exactly is not possible) but alternatively I can clear browsers history and its cache. I already tried a lot of javascripts like window.history and all but of no use. Please correct where i am going wrong. An alternate solution is to close current browser and open a new fresh one with my homepage (so that back/forward buttons will be disabled initially) but I am unable to do this.
On Signout in codebehind I am doing this:
:-OSession.Clear();
Session.Abandon();
FormsAuthentication.SignOut();
Response.Expires = 0;
Response.Cache.SetNoStore();
Response.AppendHeader("Pragma", "no-cache");
Response.Redirect("Homepage.aspx");
I also tried this Javascript but of no use:
Session.Clear();
Session.Abandon();
FormsAuthentication.SignOut();
Response.Write("");
Response.Write("{");
Response.Write(" var Backlen=history.length;");
Response.Write(" history.go(-Backlen);");
Response.Write(" window.location.href='" + nextpage + "'; ");
Response.Write("}");
Response.Write("");
Thanks
Naresh
|
|
|
|
|
Hi All,
I am working on an application where I wants to display employee details in GridView. The image of the employee is stored in SQL Server 2005 table as image field . Now I wants to display the data along with the grid so how to display this can anybody help me with code.
Thanks
Regards
Sujit
|
|
|
|