|
Hi,
Thank you for our reply.
Actually i don't use the MarshalAs attribute to declare the array size in the structure.
And i want to read the 48 byte of data from the file.
and allocate the 48 byte of data into my structure.
the structure member break off will be
UInt16
UInt16
Byte[3] ==>3 Byte data-->This is my array to hold the 3 byte of data
Byte[3] ==>3 Byte date-->This is my array to hold the 3 byte of data
UInt16
UInt16
1 Byte
UInt32[8]==>32 Byte data-->this is my array to hold the 32 byte of data
1 Byte
But at once shot i want to copy my structure.
for the i used Marshl
But now i'm not to use the marshal
i have to use the BitConverter Class
using that how to copy my struture.
With Regards
Mahesh
|
|
|
|
|
Hi,
1.
without Marshal attributes any array embedded in a class or struct will be a reference, not the actual data (so it takes 4 or 8 bytes for Win32/Win64); so you need ByValArray and SizeConst .
2.
Your Int32 array is badly aligned; when a data item isn't naturally aligned, there will be a performance hit. If you can freely choose the struct layout I recommend:
- either to move the largest types first (longs, ints, shorts, bytes)
- or to explicitly add padding bytes so each element aligns on its natural boundary (i.e. each int is at an offset that is a multiple of 4).
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hi,
Is it possible copy by using BitConverter class
With Regards
Mahesh
|
|
|
|
|
No.
BitConverter converts predefined value types (boolean, char, int, double, ...) to/from bytes or another predefined value type, as should be clear from the documentation. It does not handle user-defined structs nor arrays.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hi,
i have created text to image conversion.
i need image to hexa format???
bez of i want to sent serial port in hexa format.
please anyone help me ....
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
Why? The hexadecimal formatted string would get sent through the serial port as bytes anyway. You might find it simpler to Save the Bitmap to a MemoryStream, then writing the raw bytes to the SerialPort instead. To convert the MemoryStream to a Byte array, use the ToArray method.
|
|
|
|
|
thnx for reply...
give me some example..
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
No. I wouldn't be doing you any favours if I sent you the code. The code for converting an image to a byte array is publicly available, as is the SerialPort class.
|
|
|
|
|
Dear All, I have following Query in Acces. I am trying to alter this query. How can i write the alter Statement for this query using c#?
PARAMETERS comId Guid, subprojId Guid;
SELECT Community.CommunityID, Community.CommunityCode, Subproject.SubprojectID, Subproject.SubprojectCode, IIf(Subproject.SubprojectStatusID In (1,2,4),Subproject.PlannedNSPBudgetAFA,IIf(Subproject.SubprojectStatusID In (3,5,6),Subproject.ActualNSPBudgetAFA,0)) AS TotalSubProjectBudget, zSubprojectStatus.SubprojectStatus, Subproject.SubprojectStatusID, Subproject.PlannedCDCBudgetAFA, Subproject.PlannedStartDate, Subproject.PlannedEndDate, Subproject.DateForm7Filled, Subproject.ActualNSPBudgetAFA, Subproject.ActualCDCBudgetAFA, Subproject.ActualStartDate, Subproject.ActualEndDate, Subproject.PMUSFSRApprovalDate, Subproject.ActualSkilledLabors, Subproject.ActualUnSkilledLabors, Subproject.SubprojectCompletionReason, Community.BGEntitlementAFA, Subproject.PlannedNSPBudgetAFA, vw_getPaidInstallments.PaidActualNSPAmountAFA AS PaidInstallmentAFA, IIf(IsNull([vw_getRemainingCDCBudget].[RBGE]),[BGEntitlementAFA],[vw_getRemainingCDCBudget.RBGE]) AS RemainingBG
FROM (Community INNER JOIN vw_getRemainingCDCBudget ON Community.CommunityID = vw_getRemainingCDCBudget.CommunityID) INNER JOIN ((Subproject INNER JOIN zSubprojectStatus ON Subproject.SubprojectStatusID = zSubprojectStatus.SubprojectStatusID) LEFT JOIN vw_getPaidInstallments ON Subproject.SubprojectID = vw_getPaidInstallments.SubprojectID) ON Community.CommunityID = Subproject.CommunityID
WHERE (((Community.CommunityID)=[comId]) AND ((Subproject.SubprojectID)=[subprojId]) AND ((Subproject.SubprojectStatusID) In (1,2,3,4)));
would appreciate only the alter statement to update this query.
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Solved!!!
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
I have create a property of System.object return type
I want to change its Type at runtime according to my need.
for example I want to convert it into System.String or System.Enum.
is it possible ?
Thanks.
|
|
|
|
|
You can write a generic method, I'm not sure if you can write one where the generic type specifies the return type, but I expect so. Or you can cast your object to whatever you like, but the real kicker is, how do you get the method to return objects of different types all the time ? Generics will do that, but how do you define the instance of the object to have the value you want, if it could be any type of object ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I want to implement dropdown list in web parts in asp.net 2.0, so that i can implement personalization.
there must be Enum to use dropdown list.
I have created Enum Dynamically. I already created a Propert of System.object return type. now i want to change its return type as per Enum, i created dynamically.
Thats why i need some solution of it.
if you have any idea, please let me know.
Thanks.
|
|
|
|
|
I already told you the only solution that might possibly work.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
hi i have added a combobox column to my datagrid and i want to populate it with integer list.how can i set data type of this column to hold integer values.
|
|
|
|
|
I understand you have set the DataSource of the DataGridViewComboBoxColumn, as well as its DisplayMember and ValueMember properties.
When you have done so, just set the ValueType property of it, like so:
((DataGridViewComboBoxColumn)dataGridView1.Columns[2]).ValueType = typeof(Int32);
Obviously, changing the name of dataGridView1 to your datagridview's name and the index (in this instance: 2) to the index of your combobox column.
Hope it helps.
var question = (_2b || !(_2b));
|
|
|
|
|
how should i place the datetimepicker in datagridview
using c# 2008
|
|
|
|
|
You'll have to be a little more vague with your question.
What do you want, what have you tried?
only two letters away from being an asset
|
|
|
|
|
i want to place a column, and for each cell in a row. will have a datetime picker control.
|
|
|
|
|
OK, what have you tried so far? Is this for ASP.NET or WinForms?
Create a template column and add the datetime picker.
only two letters away from being an asset
|
|
|
|
|
Sir, can u please suggest me for window application ?
|
|
|
|
|
|
hi,
i successful to create my 3 tier with the WCF method.(3 tier in coding and physical structure)
my project i divided into several layers.
myWCF(host), myClient(GUI/exe), myClientBz(Business Logic), myDAL(Data Access Layer), myClientInterfaces(interface)
Error, if call more than 1 host.
My Business Logic will more than 1 class.
And i intending to make interface to myDAL(data access layer)
setup config file in myWCF and myClient
Due to text limitation i only copy out the important part.
myHost config file: due to "<,>" allow not allow there, i change to "()"
(services)
(service behaviorConfiguration="metadataBehavior" name="myClientBz.myMessager")
(endpoint address="myMessagerService" binding="basicHttpBinding" bindingConfiguration="" name="basicHttp" contract="myClientInterfaces.imyMessager" /)
(endpoint binding="mexHttpBinding" bindingConfiguration="" name="metadataExchange" contract="IMetadataExchange" /)
(host)
(baseAddresses)
(add baseAddress="http://cspc/myMessager" /)
(/baseAddresses)
(/host)
(/service)
(/services)
myClient config file (i created by running the host exe, same time add service references at myClient's reference)
(client)
(endpoint address="http://cspc/myMessager/myMessagerService"
binding="basicHttpBinding" bindingConfiguration="basicHttp"
contract="myMessagerService.imyMessager" name="basicHttp" />
(/client)
Begin host:
using (ServiceHost host = new ServiceHost(typeof(myMessager)))
{
host.Open();
Console.ReadLine();
host.Close();
}
to test my exe are ok, i write form1 in myClient and test in other pc
myMessagerService.imyMessager proxy = new myClient.myMessagerService.imyMessagerClient();
string result = proxy.SendMessage();
MessageBox.Show(result, "xx");
it work fine. it return me a message that i write in myClient
If myClientBz required extra class, what needed in next?
Required to add myCaculation, myInformation into myClientBz.
Same i need to add interface for myCaculation, myInformation into myClientInterfaces right?
My project going to Touch on SQL DataBase.
which mean i required to add interface and config file(myDAL) again? or is depend how i write
the coding that the way i communicate with my SQL DB?
Please give advise or sample.
by memeber 2321293
CSTan
|
|
|
|
|
Can Someone please help me. I am trying to learn the use of datasets....
I can easily grab the data without a dataset from this table and apply the changes back to the sql server. But when I use the dataset I can only retrieve the data from sql server. Everytime I try doing the following C# Code to update the data in a sql server table stored in a dataset then apply the dataset back to sql server. The Environment comes back to me and complains.
Here Is the error I keep getting:
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
private void btnOptionSaveChanges_Click(object sender, EventArgs e)
{
SQLObjects MySQLObjects = new SQLObjects();
if (StandardProcedures.SQL_TestConnection(WhatIsMyConnectionString) == false)
{
MessageBox.Show("There is an issue with the application's connection string or ability to communicate with SQL Server! No Changes will be made.");
return;
}
if (!StandardProcedures.SQL_CheckToSeeIfTheObjectAlreadyExistsInSQLServer(WhatIsMyConnectionString, MySQLObjects.Table, "tblSoftwareControls"))
{
MessageBox.Show("tblSoftwareControls table does not exist in the Database. No Changes will be made");
return;
}
string sql = @"SELECT * FROM tblSoftwareControls";
SqlConnection conn = new SqlConnection(WhatIsMyConnectionString);
try
{
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
DataSet ds = new DataSet();
da.FillSchema(ds, SchemaType.Source, "tblSoftwareControls");
da.Fill(ds, "tblSoftwareControls");
DataTable dt = ds.Tables["tblSoftwareControls"];
DataRow dr;
if (dt.Rows.Count > 0)
{
dr = dt.Rows[0];
dr.BeginEdit();
dr["ConnectionString"] = txtApplicationConnectionString.Text;
dr["SplashScreenTimer"] = txtSplashScreenTimer.Text;
dr["VersionOverride"] = ckbxOverrideVersionByPass.Checked;
dr.EndEdit();
StandardProcedures.DebugLogWriter("Updated the record in tblSoftwareControls!");
}
else
{
dr = dt.NewRow();
dr["ConnectionString"] = txtApplicationConnectionString.Text;
dr["SplashScreenTimer"] = txtSplashScreenTimer.Text;
dr["VersionOverride"] = ckbxOverrideVersionByPass.Checked;
dt.Rows.Add(dr);
StandardProcedures.DebugLogWriter("Wrote a new record to tblSoftwareControls!");
}
SqlCommandBuilder objCommandBuilder = new SqlCommandBuilder(da);
da.Update(ds, "tblSoftwareControls");
StandardProcedures.DebugLogWriter("DataSet modifications or additions or deletions has the modifications applied to the SQL Server Table.");
}
catch (Exception ex)
{
StandardProcedures.ErrorLogWriter("Trying to populate the Options Tab: " + ex.ToString());
}
finally
{
conn.Close();
}
}
|
|
|
|
|
Ha... Thanks for the help but I figured it out....
The SQL Server table must have a primary key applied to one of the field for the above process to generate an update or delete procedure. Otherwise I would have to generate my own update or delete procedure and not use the above method.
|
|
|
|
|