|
Hello.
I want copy part of table from one Database to table in another Database.
In this code in line adp.Fill(dsArchive, "Archives"); i have error of incorrect types of fields. When i removed condition"WHERE..." i haven't errors ,but nothing working. Data don't transfer.(Vial_Date - field of table,type DATATIME, contents - data, for example 22/02/2007; SelectedData - data for condition in SQL) Where i mistaked?
My email: evgenik@sysmop.com.
Thanks.Evgeni Kosakovski.
public void BackupArchivesDB(string SelectedData)
{
int tblArchiveCount, tblBackupCount;
adp = new System.Data.OleDb.OleDbDataAdapter();
DataSet dsArchive = new DataSet();
DataSet dsBackup = new DataSet();
conArchive.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Archives.mdb;Jet OLEDBatabase Password=abc";
conBackup.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Backup.mdb;Jet OLEDBatabase Password=abc";
try
{
conArchive.Open();
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
try
{
conBackup.Open();
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
comArchive.Connection = conArchive;
comArchive.CommandText = "SELECT * FROM Archives WHERE Vial_Date < '" + SelectedData + "'";
comBackup.Connection = conBackup;
comBackup.CommandText = "SELECT * FROM Backup";
try
{
adp.SelectCommand = comArchive;
adp.Fill(dsArchive, "Archives");
adp.SelectCommand = comBackup;
adp.Fill(dsBackup, "Backup");
dsBackup.Merge(dsArchive);
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
finally
{
conArchive.Close();
conBackup.Close();
}
}
|
|
|
|
|
Fix this?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Hi,
I need to open a spreadsheet document in a listView. The code that I have opens the document, but only prints the first column's data. I need it to print all the data. I also need to add a new column in the spreadsheet as it loads. Please help!
Regards,
Mvelo Walaza
Developer
Telkom SA
|
|
|
|
|
Good Day,
How can I convert a Full path like C:\Documents and Settings\ to C:\Docum~1\
Regards,
Ian
|
|
|
|
|
GetShortPathName is what you need, theres an example here[^].
Dave
|
|
|
|
|
I don't think there is any built-in support for this in the Framework. However it can be achieved through the Windows API. See this article[^].
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi all,
My main application form occupies two listview controls.
Whenever I select a line in one of the listviews, I lose the selection of the selected line in the 2nd listview.
The solution of setting the 'HideSelection' property to 'true' is not good enough since I want the selected lines in both listviews to be colored blue, not grey.
Any suggestions?
Thanks a lot,
Eyal.
|
|
|
|
|
Write your own code to change the colour of the whole row when it is selected.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
OK, I guess you mean I should select custom color for the line when the control is not in focus (in case 'HideSelection' property iquals 'true').
How do I do that?
Thanks!
|
|
|
|
|
Get a reference to the item(s) that are selected from the SelectedItems property of the control. Then set the BackColor property of each item to an appropriate colour.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
How can i store path name of zip file in DataBase Sql Server so user can download it easily with out effecting on database.
|
|
|
|
|
Member 4370898 wrote: How can i store path name of zip file in DataBase Sql Server so user can download it easily with out effecting on database.
Your question doesn't really make sense.
You want to store a file path in your SQL database? So, just stick it in a table.
What do you mean, 'with out effecting...'?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
It's just a string, so just store it.
Either you really shouldn't be working on a database app until you learn some basics or ( more likely ) you've not asked what you meant to ask. Is the issue that you don't know how to store the zip files logically in your file system ? There's a Path.GetTemporaryFileName ( or similar ) method you can use to create meaningless unique file names if you're worried about collisions.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Actually i want to store physical path of file in database.so help me.
|
|
|
|
|
Hi All,
I need to consume a XML and I have Request XML and some C# code to consume response.
Now as far as I have seen we can directly call webmethods, by adding web reference.
Not sure if we can use Request XML to call web method. If we can, is there a sample or article discussing this?? Whats the ideal way of doing this??
|
|
|
|
|
You could write a simple web service that returns XML by using a HttpHandler. More information on this topic can be found here[^].
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks Paul...I dont have control over creating that service. I need to consume that service which accepts and return XMl using Soap. Now the question is "Can I make a request to that Service using Soap XML instead of directly calling those web methods from codebehind??
Keep DotNetting!!
GeekFromIndia
|
|
|
|
|
Yes, although I haven't tried to do it myself. The following Google[^] search threw up some useful information though.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Can someone please tell me if I'm approaching this incorrectly (and if so, suggest a better way) or tell me if I just can't do this at all?
I have 3 tables:
Table 1
tableOneID (PK)
displayString
Table 2
tableTwoID (PK)
displayString
tableOneID (FK)
Table 3
tableThreeID (PK)
displayString
tableTwoID (FK)
I want to be able to display the information in 3 combo boxes, filtered by the selection the 'upper' combo boxes. I have a dataset containing 3 datatables and have created relationships between the tables. It all works great for the first two combo boxes (cboTable_2's data is filtered correctly by selection in cboTable_1) but not for the next combo box - I want cboTable_3's data to be populated based on the selection in cboTable_2.
OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM Table_1", conn);<br />
da.Fill(ds, "Table_1");<br />
<br />
da = new OleDbDataAdapter("SELECT * FROM Table_2", conn);<br />
da.Fill(ds, "Table_2");<br />
<br />
da = new OleDbDataAdapter("SELECT * FROM Table_3", conn);<br />
da.Fill(ds, "Table_3");<br />
<br />
DataColumn masterOne = ds.Tables["Table_1"].Columns["tableOneID"];<br />
DataColumn childOne = ds.Tables["Table_2"].Columns["tableOneID"];<br />
DataRelation relation = new DataRelation("RelationMasterChild", masterOne, childOne);<br />
ds.Relations.Add(relation);<br />
<br />
cboTable_1.DataSource = ds;<br />
cboTable_1.DisplayMember = "Table_1.displayString";<br />
cboTable_1.ValueMember = "Table_1.tableOneID";<br />
<br />
cboTable_2.Datasource = ds;<br />
cboTable_2.DisplayMember = "Table_1.RelationMasterChild.displayString";<br />
cboTable_2.ValueMember = "Table_1.RelationMasterChild.tableTwoID";<br />
<br />
DataColumn masterTwo = ds.Tables["Table_2"].Columns["tableTwoID"];<br />
DataColumn childTwo = ds.Tables["Table_3"].Columns["tableTwoID"];<br />
relation = new DataRelation("RelationChildChild", masterTwo, childTwo);<br />
ds.Relations.Add(relation);<br />
<br />
cboTable_3.Datasource = ds;<br />
cboTable_3.DisplayMember = "Table_2.RelationChildChild.displayString";<br />
cboTable_3.ValueMember = "Table_2.RelationChildChild.tableThreeID";
The problem: On load this data is displayed correctly
cboTable_1 filters data in cboTable_2 which in turn filters data in cboTable_3
but when cboTable_1 and/or cboTable_2 selection is changed, cboTable_3 is not updated
Thanks for any input.
modified on Sunday, March 2, 2008 11:17 AM
|
|
|
|
|
Hi,
I want to use SHGetFileInfo from shell32.dll u can pass string or pidl(ITEMIDLIST structure) for first param the problem is: u can't convert string (file path) to pidl or vice versa. so I use IntPtr for first param. but the problem is I can't convert pidl to IntPtr.
(the problem is the code below doesn't work I can't find out why)
public class FileFolder<br />
{<br />
[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]<br />
public static extern UInt32 SHGetFileInfo(IntPtr pszPath, UInt32 dwFileAttributes, ref SHFILEINFO psfi, UInt32 cbFileInfo, UInt32 uFlags);<br />
[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]<br />
public static extern Int32 SHGetSpecialFolderLocation(IntPtr hwndOwner, int nFolder, ref ITEMIDLIST ppidl);<br />
<br />
[StructLayout(LayoutKind.Sequential, Pack = 1)]<br />
public struct SHITEMID<br />
{<br />
public UInt16 cb;<br />
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]public SByte[] abID;<br />
}<br />
[StructLayout(LayoutKind.Sequential, Pack = 1)]<br />
public struct ITEMIDLIST<br />
{<br />
public SHITEMID mkid;<br />
}<br />
<br />
<br />
<br />
}<br />
<br />
<br />
uint flag = FileFolder.C_GetFileInfoFlagt.SHGFI_PIDL| FileFolder.C_GetFileInfoFlagt.SHGFI_ICON | FileFolder.C_GetFileInfoFlagt.SHGFI_SHELLICONSIZE | FileFolder.C_GetFileInfoFlagt.SHGFI_ATTRIBUTES | FileFolder.C_GetFileInfoFlagt.SHGFI_TYPENAME;<br />
<br />
FileFolder.ITEMIDLIST pidl = new FileFolder.ITEMIDLIST();<br />
if (FileFolder.SHGetSpecialFolderLocation(IntPtr.Zero, (int)0x0003, ref pidl) == 0)<br />
{<br />
MessageBox.Show("true");<br />
}<br />
<br />
IntPtr pnt = Marshal.AllocHGlobal(Marshal.SizeOf(pidl));<br />
Marshal.StructureToPtr(pidl, pnt, true);<br />
if (FileFolder.SHGetFileInfo(pnt, 256, ref info, (uint)Marshal.SizeOf(info), flag) > 0)<br />
{<br />
MessageBox.Show("Successfull");<br />
}
|
|
|
|
|
Wow! it sometimes works ! a few times it is failed. I can not find out why! plz help!
|
|
|
|
|
Haven't tried it but this[^] may help
Dave
|
|
|
|
|
No, It doesn't help. because it assumes just file system paths not pidl!. you can not convert every pidl to string.
|
|
|
|
|
|
thanks,
I see the code but I can't find out why my code doesn't work properly. my code is like the code in the page that you mention. (the caller is not presented in the page just callee is presented)
modified on Friday, March 7, 2008 5:01 AM
|
|
|
|