|
hi All
i wnat to insert a picture in MS ACCESS table (this table field data type is Ole Object). how can i do this with out using make image strming bytes.
Thanks
Pavan Pareta
|
|
|
|
|
I don't see how you can insert a bitmap without streaming it's bytes.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I have the following problem. Whenever we pass an insert statement against database table, if anything goes wrong the exception can be cathced by using sqlexception parameter. I have done with exception where there is a problem with the primary key because i know the error code it genereates when there is a primary key error. But how can i do the same type of checking when there is an error related to foreign key. Wht is the error code for foreign key related errors.
Is there any other approach for doing this kind of things
Any suggestion is well received. thanx in advance
|
|
|
|
|
In the past, I have been able to get sql errors by looking at the inner exception of the exception that gets thrown in .Net.
|
|
|
|
|
I need to write one small C# application that can convert jpg or bmp image into DICOM medical format, just insert image other settings of DICOM structure can be hard coded. So where I can find any free .NET library or something alike that can help me to do this..
Dejan Paunovic
|
|
|
|
|
There is no free library in .NET. There's one called MyDICOM that isn't too expensive ( that is, if this is a paid project and the library is funded ). There are free libraries in C and perhaps C++, you could try to wrap them.
A DICOM is just your image wrapped in a format to store lots of metadata, so I'd imagine that what you want to do is not too hard. Excepting that I don't believe DICOM will accept a bmp, it will certainly accept standard lossy JPEG, although it's not widely used, any viewer should read it, I expect.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i have been facing problem about this (datagrid and repeater allow paging), by using microsoft visuo studio 2003, asp.net C# language. got ppl can help me slove this problem by using coding???? thanks^^
|
|
|
|
|
In Datagrid_pageIndexChanged event write
DataGrid1.CurrentPageIndex = e.NewPageIndex;
SelectCustomerservice();
//SelectCustomerservice() is a function which binds data from database to datagrid.You can Write your own binding function there.
Bhanu
|
|
|
|
|
thanks, i already solve my problem.
|
|
|
|
|
I just would like to ask for a sample code that really works on Downloading or Receiving files from the FTP.
I have these lines of code but seems like it don't work.
FtpClientConnection myftpClientConn = null;
public frmDbSynch()
{
InitializeComponent();
}
private void btnDBSynch_Click(object sender, EventArgs e)
{
String[] remoteFileNames = { "myTestFolder", "myFTPFolder" };
String localPath = @"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup";
myftpClientConn.ReceiveFiles(remoteFileNames, localPath, true, true);
}
thanks
|
|
|
|
|
Good day all
I am writing an application that change the settings of a windows service once it is installed. For instance, depending on the options a user chooses, the service must log on as Local System Account or use a particular user account. If the service is set to log on using a user account, I should supply that user's logon credentials.
Is this achievable. If yes, how can I achieve?
Thanks in advance
Kulile --- RSA
|
|
|
|
|
What i need to do is to insert into a dataset. But the same method will insert into different type tables.
For instance, 1 table might have 5 columns, but another might only have 2.
<br />
foreach (DataRow theRow in dataClasses)<br />
{<br />
string className = theRow["Class_Name"].ToString();<br />
object[] nodeSets = new object[9];<br />
<br />
if (tempDataSet.Tables[0].Rows.Count != 0)<br />
{<br />
foreach (DataRow row in tempDataSet.Tables[0].Rows)<br />
{<br />
string CMDB_Version = row.ItemArray[4].ToString();<br />
string Service = row.ItemArray[5].ToString();<br />
string Label = row.ItemArray[6].ToString();<br />
string Managed = row.ItemArray[7].ToString();<br />
string Live = row.ItemArray[8].ToString();<br />
string URL = row.ItemArray[9].ToString();<br />
string Classification = row.ItemArray[10].ToString();<br />
string Grouping = row.ItemArray[11].ToString();<br />
string Profile_Name = row.ItemArray[12].ToString();<br />
<br />
nodeSets[0] = CMDB_Version;<br />
nodeSets[1] = Service;<br />
nodeSets[2] = Label;<br />
nodeSets[3] = Managed;<br />
nodeSets[4] = Live;<br />
nodeSets[5] = URL;<br />
nodeSets[6] = Classification;<br />
nodeSets[7] = Grouping;<br />
nodeSets[8] = Profile_Name;<br />
<br />
theSaveModelDataSet.Tables["New" + className].Rows.Add(nodeSets);<br />
}<br />
}<br />
}<br />
This is what i do at the moment, but this ofcourse will only work for 1 datatable.
So the question is, how do i create a peice of code that will insert the right amount of data into each column.
Regards,
Gareth.
|
|
|
|
|
Hi,
assuming each of the tables where you want to insert data has columns with the same names as the columns in the source table you could do something like this:
foreach (DataRow theRow in dataClasses)
{
string className = theRow["Class_Name"].ToString();
DataTable tableToInsertInto = theSaveModelDataSet.Tables["New" + className];
if (tempDataSet.Tables[0].Rows.Count != 0)
{
foreach (DataRow row in tempDataSet.Tables[0].Rows)
{
DataRow rowToInsert = tableToInsertInto.NewRow();
foreach (DataColumn column in tempDataSet.Tables[0].Column) {
if (tableToInsertInto.Columns.Contains(column.ColumnName)) {
rowToInsert[column.ColumnName] = row[column.ColumnName];
}
}
tableToInsertInto.Rows.Add(rowToInsert);
}
}
}
Robert
|
|
|
|
|
Thank you, it works wonderfully.
The next question is, how do i do the same, but instead of selecting from a dataset, i get the information from a datarow[]
<br />
DataRow[] newUserServiceRows = graphShared.MainDataSet.Tables["NodeChanges"].Select("stateChanged = " + (int)ServiceModeler.ModelerClass.StateChangeType.Added + " AND className = '" + className + "' AND userCreated = 'y'");<br />
<br />
foreach (DataRow theRow1 in newUserServiceRows)<br />
{<br />
string CMDB_Version = theRow1["Node_Version"].ToString();<br />
string Service = theRow1["Node_Key"].ToString();<br />
string Label = theRow1["Node_Key"].ToString();<br />
string Managed = "";<br />
string Live = "";<br />
string URL = "";<br />
string Classification = "";<br />
string Grouping = "";<br />
string Profile_Name = "";<br />
<br />
nodeSets[0] = CMDB_Version;<br />
nodeSets[1] = Service;<br />
nodeSets[2] = Label;<br />
nodeSets[3] = Managed;<br />
nodeSets[4] = Live;<br />
nodeSets[5] = URL;<br />
nodeSets[6] = Classification;<br />
nodeSets[7] = Grouping;<br />
nodeSets[8] = Profile_Name;<br />
<br />
theSaveModelDataSet.Tables["New" + className].Rows.Add(nodeSets);<br />
}<br />
Regards,
Gareth.
|
|
|
|
|
Hi,
that's nearly the same:
DataTable tableNodeChanges = graphShared.MainDataSet.Tables["NodeChanges"];
DataRow[] newUserServiceRows = tableNodeChanges.Select("stateChanged = " +
(int)ServiceModeler.ModelerClass.StateChangeType.Added +
" AND className = '" + className +
"' AND userCreated = 'y'");
DataTable tableToInsertInto = theSaveModelDataSet.Tables["New" + className];
foreach (DataRow row in newUserServiceRows)
{
DataRow rowToInsert = tableToInsertInto.NewRow();
foreach (DataColumn column in tableNodeChanges.Column) {
if (tableToInsertInto.Columns.Contains(column.ColumnName)) {
rowToInsert[column.ColumnName] = row[column.ColumnName];
}
}
tableToInsertInto.Rows.Add(rowToInsert);
}
Robert
|
|
|
|
|
Robert, the problem with the code you suggested is that the datatable im getting the data from isnt the same as the datatable im inserting into, thus the columns.contains will never match.
|
|
|
|
|
Well then you will have to do some more manual work:
DataRow[] newUserServiceRows = graphShared.MainDataSet.Tables["NodeChanges"].Select("stateChanged = " + (int)ServiceModeler.ModelerClass.StateChangeType.Added + " AND className = '" + className + "' AND userCreated = 'y'");
foreach (DataRow theRow1 in newUserServiceRows)
{
object[] nodeSets1 = new object[] {
theRow1["Node_Version"].ToString(), theRow1["Node_Key"].ToString(),
theRow1["Node_Key"].ToString(), "", "", "", "", "", "" };
theSaveModelDataSet.Tables["New" + className1].Rows.Add(nodeSets1);
object[] nodeSets2 = new object[] {
"", "",theRow1["Node_Key"].ToString(), theRow1["Node_XXX"].ToString()
theRow1["Node_YYY"].ToString(), "", "", "", "", "", "" };
theSaveModelDataSet.Tables["New" + className2].Rows.Add(nodeSets2);
object[] nodeSets3 = new object[] {
theRow1["Node_Key"].ToString(), theRow1["Node_Key"].ToString(),
"", "", "", "", "", theRow1["Node_Key"], "" };
theSaveModelDataSet.Tables["New" + className3].Rows.Add(nodeSets3);
}
This generally hardcodes how the object arrays for each destination table have to be generated. I just invented some combination. Thus you wil have to make it correct yourself.
Robert
|
|
|
|
|
Hi,
Is method hiding polymorphism?
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
No
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
It can be and it can be not. It all depends upon situation.
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
Polymorphism is when derived classes do different things by overriding base methods. Hiding members does not fit that definition.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
but in actualy they are hiding the actual definition of the methods of base classes.
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
Oh, sure - they are replacing them.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: they are replacing them
i agree with you Christian Graus.
what i understand is that c# suggest member hiding through the new keyword, means, a new member is defined in the derived class. while polymorphism is achived through overriding (which is not hiding).
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
I have a base form and couple of derived forms.
I want to override Hide method of the base form. But the problem here is we have no facility to override hide method. How do I go about it?
Thanks in advance.
|
|
|
|