Hi All,
I have an application that fetch data thru a store proc and display in a
datagrid, but after successful execution of proc the data grid is not
visible.Please go thru the following code and plz let me know what is
missing.The data grid propertiy "Visible is true".
try
{
OracleDataAcces s oracleDA = new OracleDataAcces s("Data
Source=dsname;U ser ID=uid;Password =pwd");
if (oracleDA.OpenD BConnection() == false)
{
return;
}
OracleConnectio n oracleConn = oracleDA.DBConn ection;
OracleCommand psCommand = new
OracleCommand(" PKG_NAME.STORED _PROC_NAME", oracleConn);
psCommand.Comma ndType = CommandType.Sto redProcedure;
OracleParameter param = new OracleParameter ("RESULT_CURSOR ",
OracleType.Curs or);
param.Direction = ParameterDirect ion.Output;
psCommand.Param eters.Add(param );
param = new OracleParameter ("IN_DATE", OracleType.VarC har);
param.Direction = ParameterDirect ion.Input;
param.Value = txtBoxBeginDate .Text;
psCommand.Param eters.Add(param );
// Execute command
OracleDataReade r reader = psCommand.Execu teReader();
if (!reader.HasRow s)
{
reader.Close();
return;
}
OracleDataAdapt er odad = new OracleDataAdapt er(psCommand);
DataSet ds = new DataSet();
odad.Fill(ds);
GridView1.DataS ource = ds;
GridView1.DataB ind();
oracleConn.Clos e();
}
catch (Exception ex)
{
}
Thanks and Regards
Rinu G Pillai 4 2568
Rinu,
It seems that you are not setting the data member of the grid to point
to the table to bind to. This needs to be done for the DataGridView. If
you are using a DataGrid view, then I believe just setting the data set
should work.
Try to set the data source to the DataTable in the DataSet you just
filled.
If that doesn't work, then check to see that you are actually getting
results from the stored procedure, as that's always a possibility.
Also, if you are using the DataGridView, then make sure the
AutoGenerateCol umns property is set to true, or, if it is false, make sure
you add the columns to be bound to.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Rinu Gopalakrishna Pillai"
<Ri************ *********@discu ssions.microsof t.comwrote in message
news:DE******** *************** ***********@mic rosoft.com...
Hi All,
I have an application that fetch data thru a store proc and display in a
datagrid, but after successful execution of proc the data grid is not
visible.Please go thru the following code and plz let me know what is
missing.The data grid propertiy "Visible is true".
try
{
OracleDataAcces s oracleDA = new OracleDataAcces s("Data
Source=dsname;U ser ID=uid;Password =pwd");
if (oracleDA.OpenD BConnection() == false)
{
return;
}
OracleConnectio n oracleConn = oracleDA.DBConn ection;
OracleCommand psCommand = new
OracleCommand(" PKG_NAME.STORED _PROC_NAME", oracleConn);
psCommand.Comma ndType = CommandType.Sto redProcedure;
OracleParameter param = new OracleParameter ("RESULT_CURSOR ",
OracleType.Curs or);
param.Direction = ParameterDirect ion.Output;
psCommand.Param eters.Add(param );
param = new OracleParameter ("IN_DATE", OracleType.VarC har);
param.Direction = ParameterDirect ion.Input;
param.Value = txtBoxBeginDate .Text;
psCommand.Param eters.Add(param );
// Execute command
OracleDataReade r reader = psCommand.Execu teReader();
if (!reader.HasRow s)
{
reader.Close();
return;
}
OracleDataAdapt er odad = new OracleDataAdapt er(psCommand);
DataSet ds = new DataSet();
odad.Fill(ds);
GridView1.DataS ource = ds;
GridView1.DataB ind();
oracleConn.Clos e();
}
catch (Exception ex)
{
}
Thanks and Regards
Rinu G Pillai
Hi Nic,
Thanks a lot for your quick response.
The real problem was "AutoGenerateCo lumns = false" , now I changed to true
and it's working.
Nic, highly appreciate if you can show some code to do the rest of the
solution you mentioned , like
1 . set the data source to the DataTable in the DataSet
2 . setting the data member of the grid to point
to the table to bind to
3 .add the columns to be bound to
Once again thanks a lot!!!!.
"Nicholas Paldino [.NET/C# MVP]" wrote:
Rinu,
It seems that you are not setting the data member of the grid to point
to the table to bind to. This needs to be done for the DataGridView. If
you are using a DataGrid view, then I believe just setting the data set
should work.
Try to set the data source to the DataTable in the DataSet you just
filled.
If that doesn't work, then check to see that you are actually getting
results from the stored procedure, as that's always a possibility.
Also, if you are using the DataGridView, then make sure the
AutoGenerateCol umns property is set to true, or, if it is false, make sure
you add the columns to be bound to.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Rinu Gopalakrishna Pillai"
<Ri************ *********@discu ssions.microsof t.comwrote in message
news:DE******** *************** ***********@mic rosoft.com...
Hi All,
I have an application that fetch data thru a store proc and display in a
datagrid, but after successful execution of proc the data grid is not
visible.Please go thru the following code and plz let me know what is
missing.The data grid propertiy "Visible is true".
try
{
OracleDataAcces s oracleDA = new OracleDataAcces s("Data
Source=dsname;U ser ID=uid;Password =pwd");
if (oracleDA.OpenD BConnection() == false)
{
return;
}
OracleConnectio n oracleConn = oracleDA.DBConn ection;
OracleCommand psCommand = new
OracleCommand(" PKG_NAME.STORED _PROC_NAME", oracleConn);
psCommand.Comma ndType = CommandType.Sto redProcedure;
OracleParameter param = new OracleParameter ("RESULT_CURSOR ",
OracleType.Curs or);
param.Direction = ParameterDirect ion.Output;
psCommand.Param eters.Add(param );
param = new OracleParameter ("IN_DATE", OracleType.VarC har);
param.Direction = ParameterDirect ion.Input;
param.Value = txtBoxBeginDate .Text;
psCommand.Param eters.Add(param );
// Execute command
OracleDataReade r reader = psCommand.Execu teReader();
if (!reader.HasRow s)
{
reader.Close();
return;
}
OracleDataAdapt er odad = new OracleDataAdapt er(psCommand);
DataSet ds = new DataSet();
odad.Fill(ds);
GridView1.DataS ource = ds;
GridView1.DataB ind();
oracleConn.Clos e();
}
catch (Exception ex)
{
}
Thanks and Regards
Rinu G Pillai
Rinu,
If you want to bind to the data table, then you can get the table
yourself by accessing the Tables property on the DataSet. If you want to
use the DataMember property on the DataGridView, then you can set the
DataSource property to the DataSet instance and then set the DataMember
property to the name of the table, the same thing you would pass to the
string indexer for the collection returned by the Tables property.
To add the columns to bind to, you would have to call the Add method on
the DataGridViewCol umnCollection which is exposed by the Columns property on
the DataGridView.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Rinu Gopalakrishna Pillai"
<Ri************ *********@discu ssions.microsof t.comwrote in message
news:A3******** *************** ***********@mic rosoft.com...
Hi Nic,
Thanks a lot for your quick response.
The real problem was "AutoGenerateCo lumns = false" , now I changed to true
and it's working.
Nic, highly appreciate if you can show some code to do the rest of the
solution you mentioned , like
1 . set the data source to the DataTable in the DataSet
2 . setting the data member of the grid to point
to the table to bind to
3 .add the columns to be bound to
Once again thanks a lot!!!!.
"Nicholas Paldino [.NET/C# MVP]" wrote:
>Rinu,
It seems that you are not setting the data member of the grid to point to the table to bind to. This needs to be done for the DataGridView. If you are using a DataGrid view, then I believe just setting the data set should work.
Try to set the data source to the DataTable in the DataSet you just filled.
If that doesn't work, then check to see that you are actually getting results from the stored procedure, as that's always a possibility.
Also, if you are using the DataGridView, then make sure the AutoGenerateCo lumns property is set to true, or, if it is false, make sure you add the columns to be bound to.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Rinu Gopalakrishna Pillai" <Ri*********** **********@disc ussions.microso ft.comwrote in message news:DE******* *************** ************@mi crosoft.com...
Hi All,
I have an application that fetch data thru a store proc and display in
a
datagrid, but after successful execution of proc the data grid is not
visible.Please go thru the following code and plz let me know what is
missing.The data grid propertiy "Visible is true".
try
{
OracleDataAcces s oracleDA = new OracleDataAcces s("Data
Source=dsname;U ser ID=uid;Password =pwd");
if (oracleDA.OpenD BConnection() == false)
{
return;
}
OracleConnectio n oracleConn = oracleDA.DBConn ection;
OracleCommand psCommand = new
OracleCommand(" PKG_NAME.STORED _PROC_NAME", oracleConn);
psCommand.Comma ndType = CommandType.Sto redProcedure;
OracleParameter param = new OracleParameter ("RESULT_CURSOR ",
OracleType.Curs or);
param.Direction = ParameterDirect ion.Output;
psCommand.Param eters.Add(param );
param = new OracleParameter ("IN_DATE", OracleType.VarC har);
param.Direction = ParameterDirect ion.Input;
param.Value = txtBoxBeginDate .Text;
psCommand.Param eters.Add(param );
// Execute command
OracleDataReade r reader = psCommand.Execu teReader();
if (!reader.HasRow s)
{
reader.Close();
return;
}
OracleDataAdapt er odad = new OracleDataAdapt er(psCommand);
DataSet ds = new DataSet();
odad.Fill(ds);
GridView1.DataS ource = ds;
GridView1.DataB ind();
oracleConn.Clos e();
}
catch (Exception ex)
{
}
Thanks and Regards
Rinu G Pillai
Hi,
"Rinu Gopalakrishna Pillai"
<Ri************ *********@discu ssions.microsof t.comwrote in message
news:A3******** *************** ***********@mic rosoft.com...
Hi Nic,
Thanks a lot for your quick response.
The real problem was "AutoGenerateCo lumns = false" , now I changed to true
and it's working.
A more fine grained control can be obtained by using TemplateColumns
instead. Especially regarding the header text of the column. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Schu |
last post by:
I am trying to show a grid in a text box in an aspx page
but I am not able to convert the GUID to a string. Here
is the line I am trying to get to work:
textbox1.text = grid.datakeys(e.item.itemindex)
Can anyone tell me how to do this?
Schu
|
by: Amber |
last post by:
The DataGrid allows you to make columns visible or invisible on demand
- even edit and other special columns. This article will show you how
it is done.
Some developers have reported problems controlling the visibility of
columns in the DataGrid control. The problem usually comes down to one
fact. The DataGrid has a property called AutoGenerateColumns. The
default value is "True". This means that when AutoGenerateColumns is
set to True,...
|
by: John |
last post by:
Hi! Guys
I think some of you can help me here.
Here is the situation......
I have a following columns from different tables and
get a Dataset to Bind with a data grid.
1)ItemId int
2)FeatureId smallint
3)ItemName nvarchar(255)
|
by: Alan Silver |
last post by:
hello,
I have a database table that stores names of schools, and I want o write
a page that allows someone to change the list.
I was wondering about showing the schools in a table, with existing
school names being in textboxes, each with a "delete" checkbox.
Modifying a school name would involve typing the changes in the textbox
and clicking a Submit button. Deleting a school would involve checking
the school(s) to be deleted, and...
|
by: tshad |
last post by:
I have a Datagrid that has no rows in it, but I want the title to show, and
they aren't.
Is there a way to make them visible even if the Datagrid is empty?
Thanks,
Tom
| |
by: Sebastian Santacroce |
last post by:
How do I get a datetime field from a database to show just
time in the datagrid. The default just shows date.
Thank you
Sebastian
|
by: Andy Savelle |
last post by:
I have recently started working with Visual Basic .NET.
Having very little experiance in VB .NET, I am starting
from the gound up with very simple programs. One of my
first task to achieve is accessing an AS/400 data file (
in real time located on the AS400) and displaying it on a
webpage over the internet. I am wanting to acheive this
by placing the data in a data grid on the web page.
I have been working with entry level (tutorials)...
|
by: TerryW |
last post by:
I am using a system.windows.forms.datagrid and i set it's data
source to a system.data.datatable which has a column that's
dataType is system.dateTime. When I try to enter minutes and
seconds into the grid it removes that time data and leaves only
the date. The time information is still there though.
How can I make the time visible?
TIA TerryW
|
by: ajk |
last post by:
Hi
I was wondering how to show different properties in design and
run-mode for a user control? Is it possible to do this when
implementing the System.ComponentModel.ICustomTypeDescriptor
interface?
e.g. when selecting the control from a toolbox with controls other
properties show up when the program is in design mode than in run
mode.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |