|
Glen,
You only get the first table because you're using the executeScalar method.
To get what you want you need to use the executeReader.
Your code would thus be smth like:
SqlConnection connection = new SqlConnection(connectionString);
string command = "Select name From sysobjects where type ='U'";
SqlCommand getTableList = new SqlCommand(command, connection);
myConnection.Open();
SqlDataReader reader = getTableList.ExecuteReader(CommandBehavior.CloseConnection);
List<string> tables=new List<string>();
while(reader.Read())
{
tables.Add(reader.GetString(0));
}
reader.Close();
//Implicitly closes the connection because CommandBehavior.CloseConnection was specified.
This should get you the list.
Greeting
Kaine
|
|
|
|
|
I agree fully with Kaine.
just an alternate method when using a reader.
SqlDataReader reader = getTableList.ExecuteReader();
and then continue to add to the tables, while using reader.Read().
Keshav Kamat
India
|
|
|
|
|
Thansk for that - much appreciated.
Glen Harvy
|
|
|
|
|
Hi All,
I have some old project that implement some GUI in MFC.
I need to change one of the dialog in this GUI - and i found out that i can do it in very easy way in C#.
Can / How can i mix between those two language ? i want to do in in the easy way - but i don't want to write all the application in C# ... Someone have a idea ?
Thanks for any help.
|
|
|
|
|
|
how to call crystal report
|
|
|
|
|
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True"
ReportSourceID="CrystalReportSource1" DisplayGroupTree="False" HasExportButton="False"
HasToggleGroupTreeButton="False" Height="1106px" Width="751px"></CR:CrystalReportViewer>
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
<Report FileName="CrystalReportOrderDetails.rpt">
<Parameters>
<CR:Parameter ConvertEmptyStringToNull="False" DefaultValue="24994" Name="@ORDER_NUMBER"
ReportName="" />
</Parameters>
<DataSources>
<CR:DataSourceRef DataSourceID="ObjectDataSource1" TableName="InvoiceDetails" />
</DataSources>
</Report>
</CR:CrystalReportSource>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="InvoiceDetails"
TypeName="Kings.OrdersDB" OldValuesParameterFormatString="original_{0}">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="24994" Name="ORDER_NUMBER" QueryStringField="OrderNo"
Type="String" />
</SelectParameters>
|
|
|
|
|
Hi all
I'm trying to use a .Net dll in deployment custom actions, when a add the primary output from the dll to the deployment application and the set the custom actions to the dll the properties windows require an "Entry Point" i have searched every concievable source i know of and have not found a example or solution. Plenty examples where the project installer class is inserted into the application project.
would appreciate your help
Thanks in advance.
|
|
|
|
|
I am making a http request to a html file placed on a Apache server.
On this page there is an embeded perl statement which requires
reading environment variables.
The contents of the page change according to the environment variables.
When I am typing the url of the html page in my browser, I am able to
read the Environment variables and getting the desired results.
But, when I am making Http request through my window application, it
is unable to read the the environment variables.
Please help me out.
The code used is given below:
private void GetFile(string FilePath)
{
using (WebClient wcDownload = new WebClient())
{
string strFile ="test.xml";
try
{
// Code for reading the html file from the server
String downloadUrl = @"http://www.mysite/
folder_job.html";
HttpWebRequest webRequest =
(HttpWebRequest)WebRequest.Create(downloadUrl);
webRequest.Timeout = 15000;
webRequest.Credentials =
CredentialCache.DefaultCredentials;
webResponse =
(HttpWebResponse)webRequest.GetResponse();
Int64 fileSize = webResponse.ContentLength;
strResponse = wcDownload.OpenRead(downloadUrl);
//End Code
strLocal = new FileStream(strFile,
FileMode.Create, FileAccess.ReadWrite, FileShare.Read);
int bytesSize = 0;
byte[] downBuffer = new byte[4096];
while ((bytesSize = strResponse.Read(downBuffer,
0, downBuffer.Length)) > 0)
{
strLocal.Write(downBuffer, 0, bytesSize);
}
strResponse.Close();
strLocal.Close();
webResponse.Close();
}
catch (Exception ee)
{
MessageBox.Show(ee.ToString());
}
}
}
|
|
|
|
|
I want to write a program to copy the computer screen and save it as a bit map file in c#.
Still i couldn't figure out how to start it.
I search in Code Project. But all those answers are so huge.
All i want is a simple program to capture the still picture and save it.
Hope someone could give me at least a clue on how to start this.
Thank you.
rangaSL
|
|
|
|
|
|
thanx Martin.
I'll try dat way.
rangaSL
|
|
|
|
|
hi,
i am using a datagrid view and one of the column type is datagridviewcheckbox
now i need to enable/disable the entire row based on the selection of that checkbox
help me pls
with regards
prasad
|
|
|
|
|
A quick example code. Add this to the CellClick event of the DataGridView.
<br />
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)<br />
{<br />
if (e.ColumnIndex == 2)<br />
{<br />
foreach (DataGridViewCell cell in dataGridView1.Rows[e.RowIndex].Cells)<br />
{<br />
cell.Value = "Nooooo";<br />
}<br />
}<br />
}
Enabling or disabling a row I don't really know how to do. You should explore the options of DataGridViewCell and DataGridViewRow in the object browser. Let me know when you find it.
greetz
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
hi,
it is filling the rest of the rows with specified value..
but i want to disable/enale that row ..
i am trying but not getting
help me pls..
with regards
prasad
|
|
|
|
|
As I said, I don't think it's possible to disable a row in a datagrid.
You could set it's ReadOnly property to true, or Frozen.
if (e.ColumnIndex == 2)
{
if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == null ||
(bool)(dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex]).Value == false)
{
dataGridView1.Rows[e.RowIndex].ReadOnly = true;
dataGridView1.Rows[e.RowIndex].Frozen = true;
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = true;
}
else
{
dataGridView1.Rows[e.RowIndex].ReadOnly = false;
dataGridView1.Rows[e.RowIndex].Frozen = false;
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = false;
}
}
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
Hi,
In my application, i am having a tab control.In the first tab comprises of
datagridview.and in the second tab i have placed the graph pane.
Datagridview gets populated dynamically with data which is shown as curve
in the graph pane.At times the application hangs when i change the tab.That
too when the data is added beyond the visible part ie when scroll bars are
added.Even i have used
DataGridView.ScrollBars = ScrollBars.Both;
I think the problem is with DataGridView.how can i solve this issue.
With Thanks,
Sakthi.
|
|
|
|
|
Are there any background threads involved? Do they update the UI from the correct thread?
I'd suggest you attach the application to a debugger and when the hangup happens, break into the debugger (Debug -> Break All in VS .NET). You should be able to see the exact line that's causing the hangup.
|
|
|
|
|
Hi Senthil,
Thank you very much for your reply.
I have used a timer to update the datagridview.Nothing else.
I did as you said ie attached a debugger to my application.
i could nott get the exact line as the Control stopped at the end of
application.
With Thanks and Regards,
Sakthi.
|
|
|
|
|
Then you should use breakpoints and code stepping to analyze this issue, because it doesn't sound like 'hanging' but more like premature termination (closing earlier than expected). Are there any errors in log or anywhere else?
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
Hi,
there are several kinds of timers.
Windows.Forms.Timer is the only one that fires its event on the UI thread, hence
the only one allowed to modify any Control.
Other timers (Timers.Timer and Threading.Timer) call their event callback on a
different thread, which will:
- possibly hang on .NET 1.x
- throw an Exception on .NET 2.0
If for some reason you feel you need such a timer, then you must apply the
InvokeRequired and Invoke/BeginInvoke technique.
|
|
|
|
|
Hit Ctrl+Alt+H (Debug->Windows->Threads) and go through the list, make sure your code isn't running on any of those threads and trying to update the UI.
|
|
|
|
|
Hi All,
Thank you For your replies.But still i didnt get any solution for this problem
I am using System.Timers.
That too i am getting problem only when the rows exceeds the visible region
of the datagridview. and i need to use vertical scroll bar.
With Thanks,
Sakthi.
|
|
|
|
|
SakthiSurya wrote: I am using System.Timers.
Don't use that to update UI components. I'd suggest you use System.Windows.Forms.Timer instead.
|
|
|
|
|
Hi Mr.Senthil,Mr.Pattyn and Mr.Joon,
Thank you very much for your Reply.
I tried to monitor the Threads(as said by Senthil)
But it doesnt list any Threads.
Instead of System.Timers i used System.Windows.Forms.Timers
Now my issue is solved.Everything is working Fine
One more doubt is it possible to make the UI controls Public and static
If not how can i access those controls from outside.
With Thanks,
Sakthi
|
|
|
|