|
why are u using datareader and dataset simultaneously???
follow this...
'1. Create a connection<br />
Dim myConnection as New SqlConnection(<br />
ConfigurationSettings.AppSettings("connectionString"))<br />
<br />
'2. Create the command object, passing in the SQL string<br />
Const strSQL as String = "SELECT * FROM myTable"<br />
Dim myCommand as New SqlCommand(strSQL, myConnection)<br />
<br />
'Set the datagrid's datasource to the datareader and databind<br />
myConnection.Open()<br />
DataGrid1.DataSource = myCommand.ExecuteReader(<br />
CommandBehavior.CloseConnection)<br />
DataGrid1.DataBind()
but keep in mind
A datareader is a read-only object. If you need to edit and update changes you need to use a dataset.
Tirtha
Do not go where the path may lead, go instead where there is no path and leave a trail.
Author: Ralph Waldo Emerson (1803-82), American writer, philosopher, poet, essayist
|
|
|
|
|
hmmmm but as i told i m working in windows application and it doesnt support databind option
is there any replacement or any directives/namespaces to include?
and what if i want to update records using dataset?
$h@ma!|@
|
|
|
|
|
waiting for ur answer
$h@ma!|@
|
|
|
|
|
sorry shamaila I have forgotten that yours a windows application...
then you have to make a datatable with that datareader and bind it to the datagrid....
i dont see any other option for you..
Tirtha
Do not go where the path may lead, go instead where there is no path and leave a trail.
Author: Ralph Waldo Emerson (1803-82), American writer, philosopher, poet, essayist
|
|
|
|
|
Here is a databind for a grid view in windows application:
//...
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
string strQuery = "SELECT * FROM tableTest";
SqlCommand com1 = new SqlCommand(strQuery, conn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(com1);
da.Fill(ds, "table");
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "table";
//...
I hope it works...it worked when I've tested it
|
|
|
|
|
thx alot it really worked
so nice of u...and m feeling sorry as i found ur reply too late
$h@ma!|@
|
|
|
|
|
I am having an ASP.Net application with aspCompat set to True. I am having a page that includes another aspx file. The application is to be hosted on the Internet with 'Enable Parent Paths disabled' i.e I cannot use '..' for referring to my root folder.
The folder structure of the application is as
RootFolder
MasterPages (Folder)
indexPage.aspx
includes (Folder)
pageInfo.aspx
I am constantly getting errors on the include tags the aspx page is having. I have used almost all combinations of include tags like
But all of these are giving me an 'include file not found error'. I have checked all the settings in IIS and I simply cannot understand what is the cause of this problem
I anyone knows what is the mistake I am making please let me know.
Regards
Vineed
|
|
|
|
|
Vineed wrote:
I feel this is correct. But an ascx (web user controls) will be an alternative rather than including files like classic ASP style. Regarding this problem, check in IIS that all these subfolders are configured as virtual directories ? If yes remove that. Making subfolders as virtual directories and accessing files inside that from another virtual directory may cause these type of errors.
|
|
|
|
|
Hi navaneeth
I have checked that the sub folders are not declared as Virtual Directory, Also I am not currently interested in converting the include page into ascx as we are on a deadline and need to deliver the project in a few days time. So Can you provide me with a fast patch that can work for the time being.
Thanks for your time
Vineed
|
|
|
|
|
Vineed wrote: Also I am not currently interested in converting the include page into ascx
Converting include files into ascx will take only few second and I think that is better than searching for solving the current problem. More over, that won't slow you from finishing your project before deadline.
If you are planning for ascx, What you can do is, create webusercontrol. Copy all your HTML from your current include file to there. Register user control tag in your webform. That's it you are done,..
|
|
|
|
|
Hi Navaneeth,
Thanks for your time. I think your suggestion is good enough to be implemented.
Thanks again...
Vineed
|
|
|
|
|
What type of page are you trying to include your .net pages into?
I'm not sure that you can include .aspx pages in a .asp page?
|
|
|
|
|
Hi,
Both of these pages are .aspx pages. Actually this thing works well when the 'Enable Parent Path' of IIS is enabled.
Thanks for your time
Regards
Vineed
|
|
|
|
|
How to find scroll bar position in javascript and how to lode that position after postback or page lode
help me
Piyush Vardhan Singh
Programmer
TAS NewDelhi
India
9313077379
|
|
|
|
|
|
and you can also try "SmartNavigation" turn on.
|
|
|
|
|
Dear, Why you want to get the scroll bar position..............
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Hi,
Is there a way to use groupBy in a datatable? I need to group some vaules in a column. I cannot use a sql query, as I am munipulating the data in the datatable for a gridview. I know there are no function/class available in asp.net, but maybe someone knows where to find something on the net, or had the same problem as me.
|
|
|
|
|
Hi,
Yes, we can use aggrigate functions for DataTable. Here is the sample code. You can use group by also.
<br />
DataTable table = dataSet.Tables["Orders"];<br />
<br />
object sumObject;<br />
sumObject = table.Compute("Sum(Total)", "EmpID = 5");<br />
enjoy...
regards
GV Ramana
|
|
|
|
|
Thanks Ramana.
Now if I want to group on a string, how would I do that?
My columns in datatable are F2 and F3. I want to group by F2, where F3 is the primary key.
|
|
|
|
|
Try this code
DataRow[] dr=DataTable.Select("gruopBy ColumnName");
Home this will help u?
Best regard
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
Hi Pathan,
It looks like something that can help me, but where do I use it? Where I fill my new datatable, or from the current datatable?
|
|
|
|
|
HI.
By this code You will get array of datarow,
After that You can Import this array row in new table.
Like this
dataTable NewTable;
Datarow dr[]=datatabale.Select("groupBy columnName");
foreach(datarow dr1 in dr)
{
NewTable.ImportRow(dr1);
}
Best Regard
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
hi friends
i wrote the code in application hitcounter.whenever load the page the value is count.(it is work fine)
but i closed the project then opend,it showed the count 1
but i need whenever run the project counting will be incremented.not reset to 1
this is my code
private void Page_Load(object sender, System.EventArgs e)
{
Application.Lock();
if (Application[Request.Browser.Browser] != null)
Application[Request.Browser.Browser] = (int)Application[Request.Browser.Browser] + 1;
else
Application[Request.Browser.Browser] = 1;
Application.UnLock();
for (int i=0; i<application.count; i++)
="" response.output.write("<p="">{0} : {1} hits", Application.GetKey(i), Application[i]);
}
regards
saravanan
|
|
|
|
|
store the last updated value in a xml or database..
Just before closure of the application update the information and close!!
When opening, just update it wherever ur storing it!!!
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|