|
Your suggestions are much appreciated. Will do
|
|
|
|
|
when u have this message Syntax error in UPDATE statement.how can slove it
|
|
|
|
|
aaga5 wrote: when u have this message Syntax error in UPDATE statement.how can slove it
by fixing the syntax of your UPDATE statement.
if you want more details, maybe you should provide more details.
|
|
|
|
|
aaga5 wrote: Syntax error in UPDATE statement.how can slove it
You can read a documentation of the UPDATE statement here[^]. Stick to the syntax described there and everything should be OK. If not, please tell us what was the query.
Greetings - Jacek
|
|
|
|
|
This is the C# forum.
My signature "sucks" today
|
|
|
|
|
Hi
I'm trying to use the name of a logical drive (c: and d . I can't use them to get access to the physical drive in order to get the type, the model, the interface, the capacity, sectors and cylinders.
My code :
private void Form1_Load(object sender, EventArgs e)
{
ManagementObjectSearcher mosDisks = new ManagementObjectSearcher("SELECT * FROM Win32_LogicalDisk");
foreach (ManagementObject moDisk in mosDisks.Get())
{
comboBox2.Items.Add(moDisk["DeviceID"].ToString());
}
}
private void button4_Click_1(object sender, EventArgs e)
{
listView2.Items.Clear()
ManagementObjectSearcher mosDisks = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive WHERE DeviceID = '" + comboBox2.SelectedItem + "'");
foreach (ManagementObject moDisk in mosDisks.Get())
{
ListViewItem item = listView2.Items.Add("Type: " + moDisk["MediaType"].ToString());
ListViewItem item2 = listView2.Items.Add("Model: " + moDisk["Model"].ToString());
ListViewItem item3 = listView2.Items.Add("Interface: " + moDisk["InterfaceType"].ToString());
ListViewItem item4 = listView2.Items.Add("Capacity: " + moDisk["Size"].ToString() + " bytes (" + Math.Round(((((double)Convert.ToDouble(moDisk["Size"]) / 1024) / 1024) / 1024), 2) + " GB)");
ListViewItem item5 = listView2.Items.Add("Partitions: " + moDisk["Partitions"].ToString());
ListViewItem item6 = listView2.Items.Add("Signature: " + moDisk["Signature"].ToString());
ListViewItem item7 = listView2.Items.Add("Cylinders: " + moDisk["TotalCylinders"].ToString());
ListViewItem item8 = listView2.Items.Add("Sectors: " + moDisk["TotalSectors"].ToString());
ListViewItem item9 = listView2.Items.Add("Heads: " + moDisk["TotalHeads"].ToString());
ListViewItem item10 = listView2.Items.Add("Tracks: " + moDisk["TotalTracks"].ToString());
ListViewItem item11 = listView2.Items.Add("Bytes per Sector: " + moDisk["BytesPerSector"].ToString());
ListViewItem item12 = listView2.Items.Add("Sectors per Track: " + moDisk["SectorsPerTrack"].ToString());
ListViewItem item13 = listView2.Items.Add("Tracks per Cylinder: " + moDisk["TracksPerCylinder"].ToString());
ListViewItem item14 = listView2.Items.Add("Description: " + moDisk["Description"].ToString());
}
}
I have used this code and it worked fine but I can't get the letters instead of the Model in the combox
private void Form1_Load(object sender, EventArgs e)
{
ManagementObjectSearcher mosDisks = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
foreach (ManagementObject moDisk in mosDisks.Get())
{
comboBox2.Items.Add(moDisk["Model"].ToString());
}
}
private void button4_Click_1(object sender, EventArgs e)
{
listView2.Items.Clear();
ManagementObjectSearcher mosDisks = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive WHERE Model = '" + comboBox2.SelectedItem + "'");
foreach (ManagementObject moDisk in mosDisks.Get())
{
ListViewItem item = listView2.Items.Add("Type: " + moDisk["MediaType"].ToString());
ListViewItem item2 = listView2.Items.Add("Model: " + moDisk["Model"].ToString());
ListViewItem item3 = listView2.Items.Add("Interface: " + moDisk["InterfaceType"].ToString());
ListViewItem item4 = listView2.Items.Add("Capacity: " + moDisk["Size"].ToString() + " bytes (" + Math.Round(((((double)Convert.ToDouble(moDisk["Size"]) / 1024) / 1024) / 1024), 2) + " GB)");
ListViewItem item5 = listView2.Items.Add("Partitions: " + moDisk["Partitions"].ToString());
ListViewItem item6 = listView2.Items.Add("Signature: " + moDisk["Signature"].ToString());
ListViewItem item7 = listView2.Items.Add("Cylinders: " + moDisk["TotalCylinders"].ToString());
ListViewItem item8 = listView2.Items.Add("Sectors: " + moDisk["TotalSectors"].ToString());
ListViewItem item9 = listView2.Items.Add("Heads: " + moDisk["TotalHeads"].ToString());
ListViewItem item10 = listView2.Items.Add("Tracks: " + moDisk["TotalTracks"].ToString());
ListViewItem item11 = listView2.Items.Add("Bytes per Sector: " + moDisk["BytesPerSector"].ToString());
ListViewItem item12 = listView2.Items.Add("Sectors per Track: " + moDisk["SectorsPerTrack"].ToString());
ListViewItem item13 = listView2.Items.Add("Tracks per Cylinder: " + moDisk["TracksPerCylinder"].ToString());
ListViewItem item14 = listView2.Items.Add("Description: " + moDisk["Description"].ToString());
}
}
|
|
|
|
|
I am not sure that you can get the drive letters using the PhysicalDrive. Look up Win32_MappedLogicalDisk in the WMI documentation. From memory it is much easier to get the drive letters that way.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas? - Because 31 Oct = 25 Dec.
Business Myths of the Geek #4 'What you think matters.'
|
|
|
|
|
The logical drives (drive letters) identify partitions, not physical devices. It takes a couple of WMI objects to get most of the information you want; you will probably discover that the very physical characteristics (such as number of cylinders) don't make sense any more as they are virtualized within the drive itself; the local intelligence just makes the disk look like one heap of sectors.
Also, the latest versions of Windows (Vista, 7) are likely to refuse full access, even read access, at the device level unless you are an elevated escalated super-administrator.
|
|
|
|
|
connectionString1 = @"
server = .\sqlexpress;
integrated security = true;
database = C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\NORTHWND.MDF;
user instance = true";
connectionString2 = @"
server = .\sqlexpress;
integrated security = true;
database = northwind";
connectionString1 is working fine and connectionString2 is giving the message "Cannot open database northiwnd. login failed for user XYZ".
Can someone tell me whats the difference
|
|
|
|
|
humayunlalzad wrote: atabase = C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\NORTHWND.MDF;user instance = true";
humayunlalzad wrote: database = northwind";
The difference lies in the user instance = true part of the sql.
Read about user instances here.
My signature "sucks" today
|
|
|
|
|
@"
server = .\sqlexpress;
integrated security = true;
database = northwind;
user instance = true";
I am sorry I should have mentioned before hand, that even the above string with "user instance = true" added is not working
|
|
|
|
|
hi all
i have an win application form suppose to show some reports in CrystalReportView i have no idea how to assign a list<> of class to MyCrystalReport
public Form1()
{
InitializeComponent();
StdList = new List<studants>();
StdList.Add(new studants("1", "1", 1));
StdList.Add(new studants("2", "2", 2));
StdList.Add(new studants("3", "3", 3));
StdList.Add(new studants("4", "4", 4));
StdList.Add(new studants("5", "5", 5));
}
private void Form1_Load(object sender, EventArgs e)
{
CrystalReport1 cr = new CrystalReport1();
cr.SetDataSource(StdList);
crystalReportViewer1.ReportSource = cr;
}
but i have not assigned any table with CrystalReport1 it`s all because of i have not any dataset or database or ... and i do not know how to assign add or assign a list<> of objects to my crytalReport Project (CrystalReport1) how can i assign it and work on it
i should definitely use list<>
please help me!!!!!!!!!!
|
|
|
|
|
Does CR support List<> as a datasource? I have not used that POS in a few years but I doubt it has moved that fast.
I suggest you do some research on the Business Object web site.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have a label called lblsite that I'm trying to give a value from a cached value.
protected void Page_Load(object sender, System.EventArgs e)<br />
{<br />
lblsite.Text = (Cache("locid") + 1);<br />
}
The "locid" is set on the previous page.
protected void btnaddaddress_Click(object sender, System.EventArgs e)<br />
{<br />
Cache["locid"] = gvaddressmax.SelectedRow.Cells[0].Text;<br />
Response.Redirect("btnaddaddress.aspx");<br />
}
However, the lblsite.Text = (Cache("locid") + 1); gives me the following error and results in a null value.
'System.Web.Caching.Cache' is a Type, but being used like a variable
How can I get this to work?
|
|
|
|
|
You should have posted in the asp forum. Anyway, I think it's the parenthesis.
try (Cache)("locid") +1;
even better
(yourType)((Cache)("locid")) +1;
You did not mentioned what you stored in the previous page.
Just an irritated, ranting son of ... an IT guy.
At your trolling services
|
|
|
|
|
Randall Hall wrote: (Cache("locid") + 1)
This is the problem. Cache provides indexer access to object values, so you need to extract the value back out before you attempt to work with it. Try changing this instead to:
int value;
if (int.TryParse(Cache["locid"], out value))
{
lblsite.Text = ++value;
}
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi,
I'm interested in adding a small exit button to the top part of the active Tab Page (like the one in the IE's Tabs), in order to enable users to close tabs more easily.
I'd appreciate any info on how to acomplish this (probably involves owner drawn tab control + more), or if anyone has already implemented such Tab Contol/Tab Page - a link to it...
tnx
roy
|
|
|
|
|
I assume Winforms so here is one of the many results here on CP:
link1
Search is the key
Just an irritated, ranting son of ... an IT guy.
At your trolling services
|
|
|
|
|
Exactly what i was looking 4..
Tnx
Roy
|
|
|
|
|
If its web you may look forward to coolite [^]toolkit.
|
|
|
|
|
There's an editable datagridview populated from a table say tblItems. Among the columns of the datagridview there's a combobox column named 'Category'. This column is populated by the respective 'Category' column of tblItems. Now in the 'Category' column of the datagridview I want to set the value of a certain cell to Null programmatically. Suppose when I press keyboard Delete button over the cell or some other button on the form, the value of the cell becomes Null. Datagridview.keydown event isn't working as when the cell is selected the focus is actually on the editingcontrol of the cell and not the datagridview. Also the combobox editingcontrol doesn't have any 'SelectedIndex' property that can be set to -1. Any idea plz? Regards.
|
|
|
|
|
Add an item to your list in position 0 with a value 0 and a label of string.empty.
Set the selected index to 0.
Deal with the 0 value on the way out, when you write to the database.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
The thing is, the EditingControl property of the grid and the e.Control property in the EditingControlShowing event handler are both type Control, because they have to be able to refer to any control. If you're currently editing a combo box column though, you know that the actual object is type ComboBox (to be more precise, type DataGridViewComboBoxEditingControl) so you have to cast it as that type in order to access members of that type. This is the case no matter what objects you're dealing with: you must have a reference of the correct type to access members of that type. E.g.
ComboBox cbx = (ComboBox)myDataGridView.EditingControl;
cbx.SelectedIndex = -1;
modified on Monday, June 14, 2010 12:11 PM
|
|
|
|
|
You missed the point, this is all about managing your data not the control. The control does not deal with null so supply an alternative. It is your data, decide how you can do this, I would add a default data item into the underlying dataset and use that as the null substitue.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Why on earth it's so difficult to find a sample on the web for this topic? Nobody has ever tried putting a checkbox on a datagridview on a winform? Or my search is wrong? This thread's subject has been my search key. Gettin nothin.
What's wrong with the below code?
<br />
DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)dataGridView1.Rows[0].Cells[0];<br />
if (chk.Selected)<br />
{<br />
MessageBox.Show("Selected!");<br />
}<br />
It's always checking the "cells" selected state. I want to know if the check box has been selected(Checked!) or not.
Yes, I added column 0 to be a DataGridViewCheckBoxCell.
Anybody can help?
|
|
|
|