public class AMCOMDB : DataContext
{
public Table<student> allStudents;
public Table<aClass> allClasses;
public AMCOMDB(string connection) : base(connection) { }
}
[Table(Name = "student")]
public class student
{
private string _studentName;
[Column(IsPrimaryKey =true,Storage ="_studentName")]
public string studentName
{
get { return this._studentName; }
set { this._studentName = value; }
}
private string _LARType;
[Column(Storage ="_LARType")]
public string LARType
{
get { return this._LARType; }
set { this._LARType = value; }
}
private string _studentType;
[Column(Storage = "_studentType")]
public string studentType
{
get { return this._studentType; }
set { this._studentType = value; }
}
private string _aviationLevel;
[Column(Storage = "_aviationLevel")]
public string aviationLevel
{
get { return this._aviationLevel; }
set { this._aviationLevel = value; }
}
private string _airDefenseLevel;
[Column(Storage = "_airDefenseLevel")]
public string airDefenseLevel
{
get
{
return this._airDefenseLevel;
}
set
{
this._airDefenseLevel = value;
}
}
private string _emergencyContact;
[Column(Storage = "_emergencyContact")]
public string emergencyContact
{
get
{
return this._emergencyContact;
}
set
{
this._emergencyContact = value;
}
}
[Table(Name = "grades")]
public class grades
{
private string _studentName;
[Column(IsPrimaryKey = true, Storage = "_studentName")]
public string studentName
{
get
{
return this._studentName;
}
set
{
this._studentName = value;
}
}
private int _ET;
[Column(Storage = "_ET")]
public int ET
{
get
{
return this._ET;
}
set
{
this._ET = value;
}
}
private int _CP;
[Column(Storage = "_CP")]
public int CP
{
get
{
return this._CP;
}
set
{
this._CP = value;
}
}
private int _SB;
[Column(Storage = "_SB")]
public int SB
{
get
{
return this._SB;
}
set
{
this._SB = value;
}
}
private int _EC;
[Column(Storage = "_EC")]
public int EC
{
get
{
return this._EC;
}
set
{
this._EC = value;
}
}
private int _finalGrade;
[Column(Storage = "_finalGrade")]
public int finalGrade
{
get
{
return this._finalGrade;
}
set
{
this._finalGrade = value;
}
}
}
[Table(Name = "classes")]
public class aClass
{
private string _classNumber;
[Column(IsPrimaryKey = true, Storage = "_classNumber")]
public string classNumber
{
get
{
return this._classNumber;
}
set
{
this._classNumber = value;
}
}
private string _courseSeries;
[Column(Storage = "_courseSeries")]
public string courseSeries
{
get
{
return this._courseSeries;
}
set
{
this._courseSeries = value;
}
}
private string _courseNumber;
[Column(Storage = "_courseNumber")]
public string courseNumber
{
get
{
return this._courseNumber;
}
set
{
this._courseNumber = value;
}
}
private string _distanceLearning;
[Column(Storage = "_distanceLearning")]
public string distanceLearning
{
get
{
return this._distanceLearning;
}
set
{
this._distanceLearning = value;
}
}
private string _classStartDate;
[Column(Storage = "_classStartDate")]
public string classStartDate
{
get
{
return this._classStartDate;
}
set
{
this._classStartDate = value;
}
}
private string _classEndDate;
[Column(Storage = "_classEndDate")]
public string classEndDate
{
get
{
return this._classEndDate;
}
set
{
this._classEndDate = value;
}
}
private string _primaryInstructor;
[Column(Storage = "_primaryInstructor")]
public string primaryInstructor
{
get
{
return this._primaryInstructor;
}
set
{
this._primaryInstructor = value;
}
}
private string _secondaryInstructor;
[Column(Storage = "_secondaryInstructor")]
public string secondaryInstructor
{
get
{
return this._secondaryInstructor;
}
set
{
this._secondaryInstructor = value;
}
}
private string _location;
[Column(Storage = "_location")]
public string location
{
get
{
return this._location;
}
set
{
this._location = value;
}
}
private string _TDYCosts;
[Column(Storage = "_TDYCosts")]
public string TDYCosts
{
get
{
return this._TDYCosts;
}
set
{
this._TDYCosts = value;
}
}
private string _studentCount;
[Column(Storage = "_studentCount")]
public string studentCount
{
get
{
return this._studentCount;
}
set
{
this._studentCount = value;
}
}
private List<grades> _classGrades;
[Column(Storage = "_classGrades")]
public List<grades> classGrades
{
get
{
return this._classGrades;
}
set
{
this._classGrades = value;
}
}
AMCOMDB ADB = new AMCOMDB(connectionString);
if (ADB.DatabaseExists())
{
var stud = ADB.GetTable<student>();
var clas = ADB.GetTable<aClass>();
IQueryable<string> query = from c in stud
where c.studentName.Length > 5
orderby c.studentName.Length
select c.studentName.ToUpper();
foreach (string name in query)
{
}
//var q = from a in ADB.GetTable<student>()
// select a;
//dtStudents = LinqQuerytoDataTable(q);
//var q1 = from a in ADB.GetTable<aClass>()
// select a;
//aClass c = new aClass();
//dtClasses = reformatDataTable(q1);
}
I receive the following when I try to get information from the database at (foreach (string name in query))
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Additional information: Invalid object name 'student'.
I also get this when I first create the database:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.Linq.dll
Additional information: Unable to determine SQL type for 'System.Collections.Generic.List`1[WindowsFormsApplication1.Form1+grades]'.
remove the word Name that is what worked for me
[Table("student")]
public class student
I have:
private void Tab2KsiazkiBTSzczegoly_Click(object sender, EventArgs e)
{
string KodKsiazki;
KodKsiazki = DataWyszukajKsiazki.Rows[DataWyszukajKsiazki.CurrentCell.RowIndex].Cells[2].Value.ToString();
TSzczegolyDb _szczegoly = new TSzczegolyDb();
Global.listSzczegoly = _szczegoly.GetSZCZEGOLY(KodKsiazki);
//StringBuilder sb = new StringBuilder();
//foreach (DataGridViewCell cell in DataWyszukajKsiazki.SelectedCells)
//{
// sb.AppendLine(cell.Value.ToString());
//}
//MessageBox.Show(sb.ToString());
//}
MessageBox.Show(_szczegoly.ToString());
}
class like that:
public class TSzczegolyDb : Core.CoreMSSQL
{
static string connectionString = TconStrDb.GetConectionString();
public TSzczegolyDb()
: base(connectionString)
{
}
public List<TSzczegolyDto> GetSZCZEGOLY(string co)
{
List<TSzczegolyDto> list = null;
list = new List<TSzczegolyDto>();
SqlCommand command = new SqlCommand();
command.CommandText = "SELECT Tytul, Autorzy, ISBN10, ISBN13, IlStron, Wydawnictwo, Gatunek, Opis FROM dbo.TKsiazki WHERE dbo.TKsiazki.KodKsiazki = '" + co + "'";
SqlDataReader reader = ExecuteQuery(command);
while (reader.Read())
{
TSzczegolyDto message = new TSzczegolyDto();
if (!reader.IsDBNull(0))
{
message.Tytuł = reader.GetString(0);
}
if (!reader.IsDBNull(1))
{
message.Autorzy = reader.GetString(1);
}
if (!reader.IsDBNull(2))
{
message.ISBN10 = reader.GetString(2);
}
if (!reader.IsDBNull(3))
{
message.ISBN13 = reader.GetString(3);
}
if (!reader.IsDBNull(4))
{
message.IlStron = reader.GetInt32(4);
}
if (!reader.IsDBNull(5))
{
message.Wydawnictwo = reader.GetString(5);
}
if (!reader.IsDBNull(6))
{
message.Gatunek = reader.GetString(6);
}
if (!reader.IsDBNull(7))
{
message.Opis = reader.GetString(7);
}
list.Add(message);
}
return list;
}
and second:
public class TSzczegolyDto
{
private string _tytul;
public string Tytuł
{
get { return _tytul; }
set { _tytul = value; }
}
private string _autorzy;
public string Autorzy
{
get { return _autorzy; }
set { _autorzy = value; }
}
private string _ISBN10;
public string ISBN10
{
get { return _ISBN10; }
set { _ISBN10 = value; }
}
private string _ISBN13;
public string ISBN13
{
get { return _ISBN13; }
set { _ISBN13 = value; }
}
private long _ilstron;
public long IlStron
{
get { return _ilstron; }
set { _ilstron = value; }
}
private string _wydawnictwo;
public string Wydawnictwo
{
get { return _wydawnictwo; }
set { _wydawnictwo = value; }
}
private string _gatunek;
public string Gatunek
{
get { return _gatunek; }
set { _gatunek = value; }
}
private string _opis;
public string Opis
{
get { return _opis; }
set { _opis = value; }
}
}
I want show _szczegoly on MessageBox but when I try to MessageBox.Show(_szczegoly.ToString()); then is wrong. In _szczegoly I have string and long type data.
How to create messagebox with this data?
I think you are trying to show an Object with a MessageBox, you need to override the ToString() method to show propertly:
class TSzczegolyDb
{
public override string ToString()
{
return this.Property1 + this.Property2 /*....*/;
}
}
private static int DefaultApiClientTimeout = 30;
public WorkItemDetail GetWorkItemDetail(
int userNumber, int userNumberExternal, string applicationId,
short computerNumber, DateTime wiDate, int wiSequence,
int wiDetailSequence, bool includeImage)
{
string uri = string.Format("api/work-item-detail?userNumber={0}&userNumberExternal={1}&applicationId={2}&computerNumber={3}&wiDate={4}&wiSequence={5}&wiDetailSequence={6}&includeImage={7}", userNumber, userNumberExternal, applicationId, computerNumber, wiDate, wiSequence, wiDetailSequence, includeImage);
WorkItemDetail result = ProcessRequest<object, WorkItemDetail>(uri, "GET", null);
return result;
}
public ResponseType ProcessRequest<RequestType, ResponseType>(
string uri,
string method = "GET",
RequestType reqtype = default(RequestType))
where RequestType : new()
{
var result = ProcessRequest<RequestType>(uri, method, reqtype);
return JsonConvert.DeserializeObject<ResponseType>(result);
}
public string ProcessRequest<RequestType>(
string uri,
string method = "GET",
RequestType reqtype = default(RequestType))
where RequestType : new()
{
var request = CreateWebRequest(uri, method);
var x = (HttpWebResponse)request.GetResponse(); //the exception :(
var strResult = new StreamReader(x.GetResponseStream()).ReadToEnd();
return strResult;
}
public WebRequest CreateWebRequest(string uri, string method = "GET")
{
string url = "http://localhost:3144/" + uri;
var request = WebRequest.Create(url);
request.ContentType = "application/json; charset=utf-8";
request.Method = method;
//Convert minutes to milliseconds.
request.Timeout = DefaultApiClientTimeout * 60000;
return request;
}
above is my entire code.
I have a problem in deserialzing jsondata. from my web api method data is returning correctly but when coming to client result i.e., above code while deserializing jsondata ImageInBytes property is getting null.
[Serializable]
public class WorkItemDetail : IWorkItemKey
{
private byte[] thumbnailImage;
private byte[] image;
private short wiDetailSequence;
private string workItemDetailType;
private int networkShare;
private string networkSharePath;
private string filePath;
private string displayImageFileName;
private string imagePath;
private DateTime workItemDate;
private string documentOcr;
#region Work Item Members
/// <summary>
/// This will actually be a ShortDate from the database
/// </summary>
public DateTime WorkItemDate
{
get { return workItemDate; }
set { workItemDate = value; }
}
private int wiSequence;
public int WISequence
{
get { return wiSequence; }
set { wiSequence = value; }
}
public short WIDetailSequence
{
get { return wiDetailSequence; }
set { wiDetailSequence = value; }
}
private short _otherSideWIDetailSequence;
public short OtherSideWIDetailSequence
{
get { return _otherSideWIDetailSequence; }
set { _otherSideWIDetailSequence = value; }
}
private string sourceType;
public string SourceType
{
get { return sourceType; }
set { sourceType = value; }
}
private string sourceIdentifier;
public string SourceIdentifier
{
get { return sourceIdentifier; }
set { sourceIdentifier = value; }
}
#endregion
private int _reason;
public int Reason
{
get { return _reason; }
set { _reason = value; }
}
private short _computerNumber;
public short ComputerNumber
{
get { return _computerNumber; }
set { _computerNumber = value; }
}
private string _computerName;
public string ComputerName
{
get { return _computerName; }
set { _computerName = value; }
}
private DateTime? _WIDateDest;
public DateTime? WIDateDest
{
get { return _WIDateDest; }
set { _WIDateDest = value; }
}
private int? _WISequenceDest;
public int? WISequenceDest
{
get { return _WISequenceDest; }
set { _WISequenceDest = value; }
}
private short? _WIDetailSequenceDest;
public short? WIDetailSequenceDest
{
get { return _WIDetailSequenceDest; }
set { _WIDetailSequenceDest = value; }
}
private short? _OtherSideWIDetailSequenceDest;
public short? OtherSideWIDetailSequenceDest
{
get { return _OtherSideWIDetailSequenceDest; }
set { _OtherSideWIDetailSequenceDest = value; }
}
public string WorkItemDetailType
{
get { return workItemDetailType; }
set { workItemDetailType = value; }
}
public int NetworkShare
{
get { return networkShare; }
set { networkShare = value; }
}
public string NetworkSharePath
{
get { return networkSharePath; }
set { networkSharePath = value; }
}
public string FilePath
{
get { return filePath; }
set { filePath = value; }
}
public string DisplayImageFileName
{
get { return displayImageFileName; }
set { displayImageFileName = value; }
}
public string ImagePath
{
get { return imagePath; }
set { imagePath = value; }
}
public byte[] ImageInBytes
{
get { return image; }
set { image = value; }
}
public byte[] ThumbnailImage
{
get { return thumbnailImage; }
set { thumbnailImage = value; }
}
private string ocrData;
public string OCRData
{
get { return ocrData; }
set { ocrData = value; }
}
private string _userName;
public string UserName
{
get { return _userName; }
set { _userName = value; }
}
private bool? _isCorrespondence;
public bool? IsCorrespondence
{
get { return _isCorrespondence; }
set { _isCorrespondence = value; }
}
private bool? isCorrespondenceDBValue;
public bool? IsCorrespondenceDBValue
{
get { return isCorrespondenceDBValue; }
set { isCorrespondenceDBValue = value; }
}
private Guid? wfInstanceId;
public Guid? WFInstanceId
{
get { return wfInstanceId; }
set { wfInstanceId = value; }
}
private DateTime _transactionTime;
public DateTime TransactionTime
{
get { return _transactionTime; }
set { _transactionTime = value; }
}
private DateTime _endTime;
public DateTime EndTime
{
get { return _endTime; }
set { _endTime = value; }
}
private string _transactionType;
public string TransactionType
{
get { return _transactionType; }
set { _transactionType = value; }
}
private string _applicationId;
public string ApplicationId
{
get { return _applicationId; }
set { _applicationId = value; }
}
private string _applicationName;
public string ApplicationName
{
get { return _applicationName; }
set { _applicationName = value; }
}
private bool isFront;
public bool IsFront
{
get { return isFront; }
set { isFront = value; }
}
private int _userNumber;
public int UserNumber
{
get { return _userNumber; }
set { _userNumber = value; }
}
private string barcode1;
public string BarCode1
{
get { return barcode1; }
set { barcode1 = value; }
}
private string barcode2;
public string BarCode2
{
get { return barcode2; }
set { barcode2 = value; }
}
private string barcode3;
public string BarCode3
{
get { return barcode3; }
set { barcode3 = value; }
}
private string barcode4;
public string BarCode4
{
get { return barcode4; }
set { barcode4 = value; }
}
private string barcode5;
public string BarCode5
{
get { return barcode5; }
set { barcode5 = value; }
}
private bool? markSense1;
public bool? MarkSense1
{
get { return markSense1; }
set { markSense1 = value; }
}
private bool? markSense2;
public bool? MarkSense2
{
get { return markSense2; }
set { markSense2 = value; }
}
private bool? markSense3;
public bool? MarkSense3
{
get { return markSense3; }
set { markSense3 = value; }
}
private bool? markSense4;
public bool? MarkSense4
{
get { return markSense4; }
set { markSense4 = value; }
}
private bool? markSense5;
public bool? MarkSense5
{
get { return markSense5; }
set { markSense5 = value; }
}
private bool? markSense6;
public bool? MarkSense6
{
get { return markSense6; }
set { markSense6 = value; }
}
private bool? markSense7;
public bool? MarkSense7
{
get { return markSense7; }
set { markSense7 = value; }
}
private bool? markSense8;
public bool? MarkSense8
{
get { return markSense8; }
set { markSense8 = value; }
}
private bool? markSense9;
public bool? MarkSense9
{
get { return markSense9; }
set { markSense9 = value; }
}
private bool? markSense10;
public bool? MarkSense10
{
get { return markSense10; }
set { markSense10 = value; }
}
private string data;
public string Data
{
get { return data; }
set { data = value; }
}
private string auditTrail;
public string AuditTrail
{
get { return auditTrail; }
set { auditTrail = value; }
}
private short? displayImageHorizontalPixels;
public short? DisplayImageHorizontalPixels
{
get { return displayImageHorizontalPixels; }
set { displayImageHorizontalPixels = value; }
}
private short? displayImageVerticalPixels;
public short? DisplayImageVerticalPixels
{
get { return displayImageVerticalPixels; }
set { displayImageVerticalPixels = value; }
}
private short? displayImageHorizontalResolution;
public short? DisplayImageHorizontalResolution
{
get { return displayImageHorizontalResolution; }
set { displayImageHorizontalResolution = value; }
}
private short? displayImageVerticalResolution;
public short? DisplayImageVerticalResolution
{
get { return displayImageVerticalResolution; }
set { displayImageVerticalResolution = value; }
}
private byte? displayImageColorDepth;
public byte? DisplayImageColorDepth
{
get { return displayImageColorDepth; }
set { displayImageColorDepth = value; }
}
private int displayImageBytes;
public int DisplayImageBytes
{
get { return displayImageBytes; }
set { displayImageBytes = value; }
}
private byte[] displayImageMD5Hash;
public byte[] DisplayImageMD5Hash
{
get { return displayImageMD5Hash; }
set { displayImageMD5Hash = value; }
}
private string iclImageFileName;
public string ICLImageFileName
{
get { return iclImageFileName; }
set { iclImageFileName = value; }
}
private short? iCLImageHorizontalPixels;
public short? ICLImageHorizontalPixels
{
get { return iCLImageHorizontalPixels; }
set { iCLImageHorizontalPixels = value; }
}
private short? iCLImageVerticalPixels;
public short? ICLImageVerticalPixels
{
get { return iCLImageVerticalPixels; }
set { iCLImageVerticalPixels = value; }
}
private short? iCLImageHorizontalResolution;
public short? ICLImageHorizontalResolution
{
get { return iCLImageHorizontalResolution; }
set { iCLImageHorizontalResolution = value; }
}
private short? iCLImageVerticalResolution;
public short? ICLImageVerticalResolution
{
get { return iCLImageVerticalResolution; }
set { iCLImageVerticalResolution = value; }
}
private byte? iCLImageColorDepth;
public byte? ICLImageColorDepth
{
get { return iCLImageColorDepth; }
set { iCLImageColorDepth = value; }
}
private int iCLImageBytes;
public int ICLImageBytes
{
get { return iCLImageBytes; }
set { iCLImageBytes = value; }
}
private byte[] iCLImageMD5Hash;
public byte[] ICLImageMD5Hash
{
get { return iCLImageMD5Hash; }
set { iCLImageMD5Hash = value; }
}
private string preparedFilePath;
public string PreparedFilePath
{
get { return preparedFilePath; }
set { preparedFilePath = value; }
}
private string displayImageFullPath;
public string DisplayImageFullPath
{
get { return displayImageFullPath; }
set { displayImageFullPath = value; }
}
/// <summary>
/// The results of full page OCR for this image, if available. This field may
/// not always be populated depending on the service method invoked and/or configuration
/// of document OCR for the particular site.
/// </summary>
public string DocumentOcr
{
get { return documentOcr; }
set { documentOcr = value; }
}
private OcrDataRecord _ocrrecord;
/// <summary>
/// Fully parsed ocr data.
/// </summary>
public OcrDataRecord OcrRecord
{
get { return _ocrrecord; }
set { _ocrrecord = value; }
}
private string _workItemLogNote;
public string WorkItemLogNote
{
get { return _workItemLogNote; }
set { _workItemLogNote = value; }
}
private bool _isDeleted;
public bool IsDeleted
{
get { return _isDeleted; }
set { _isDeleted = value; }
}
public override string ToString()
{
return string.Format("WIDate: {0} ,WISequence: {1}, WIDetailSequence: {2}, WIDetailType: {3}",
WorkItemDate.ToShortDateString(), WISequence, WIDetailSequence, WorkItemDetailType);
}
private DateTime? _batchStartDate;
public DateTime? BatchStartDate
{
get { return _batchStartDate; }
set { _batchStartDate = value; }
}
private short? _batchSeqNum;
public short? BatchSeqNum
{
get { return _batchSeqNum; }
set { _batchSeqNum = value; }
}
private short? _envelopeSequence;
public short? EnvelopeSequence
{
get { return _envelopeSequence; }
set { _envelopeSequence = value; }
}
}
other code to return
public async Task<WorkItemDetail> GetWorkItemDetailAsync(int userNumber, int userNumberExternal, string applicationId, short computerNumber, DateTime wiDate, int wiSequence, int wiDetailSequence, bool includeImage)
{
using (HttpClient client = base.CreateHttpClient())
{
WorkItemDetail workitemdetail = new WorkItemDetail();
var service_result = await client.GetAsync(string.Format("api/work-item-detail?userNumber={0}&userNumberExternal={1}&applicationId={2}&computerNumber={3}&wiDate={4}&wiSequence={5}&wiDetailSequence={6}&includeImage={7}", userNumber, userNumberExternal, applicationId, computerNumber, wiDate, wiSequence, wiDetailSequence, includeImage));
await ValidateResponseAsync(service_result);
workitemdetail = await service_result.Content.ReadAsAsync<WorkItemDetail>();
return workitemdetail;
}
}
i have collection of class "Microsoft.Exchange.Management.TransportLogSearchTasks.MessageTrackingEvent"
this is microsoft class.
this class build like the following class
public class MTE
{
private DateTime timestamp;
private string clientIp;
private string clientHostname;
private string serverIp;
private string serverHostname;
private string sourceContext;
private string connectorId;
private string source;
private string eventId;
private string internalMessageId;
private string messageId;
private string[] recipients;
private string[] recipientStatus;
private int? totalBytes;
private int recipientCount;
private string relatedRecipientAddress;
private string[] reference;
private string messageSubject;
private string sender;
private string returnPath;
private string messageInfo;
private new DateTime Timestamp
{
get { return timestamp; }
set { timestamp = value; }
}
public new string ClientIp
{
get { return clientIp; }
set { clientIp = value; }
}
public new string ClientHostname
{
get { return clientHostname; }
set { clientHostname = value; }
}
public new string ServerIp
{
get { return serverIp; }
set { serverIp = value; }
}
public new string ServerHostname
{
get { return serverHostname; }
set { serverHostname = value; }
}
public new string SourceContext
{
get { return sourceContext; }
set { sourceContext = value; }
}
public new string ConnectorId
{
get { return connectorId; }
set { connectorId = value; }
}
public new string Source
{
get { return source; }
set { source = value; }
}
public new string EventId
{
get { return eventId; }
set { eventId = value; }
}
public new string InternalMessageId
{
get { return internalMessageId; }
set { internalMessageId = value; }
}
public new string MessageId
{
get { return messageId; }
set { messageId = value; }
}
public new string[] Recipients
{
get { return recipients; }
set { recipients = value; }
}
public new string RecipientStatus
{
get { return[] recipientStatus; }
set { recipientStatus = value; }
}
public new int? TotalBytes
{
get { return totalBytes; }
set { totalBytes = value; }
}
public new int RecipientCount
{
get { return recipientCount; }
set { recipientCount = value; }
}
public new string RelatedRecipientAddress
{
get { return relatedRecipientAddress; }
set { relatedRecipientAddress = value; }
}
public new string Reference
{
get { return[] reference; }
set { reference = value; }
}
public new string MessageSubject
{
get { return messageSubject; }
set { messageSubject = value; }
}
public new string Sender
{
get { return sender; }
set { sender = value; }
}
public new string ReturnPath
{
get { return returnPath; }
set { returnPath = value; }
}
public new string MessageInfo
{
get { return messageInfo; }
set { messageInfo = value; }
}
}
When i am doing
Collection<MTE> newMTE = new Collection<MTE>();
datagridview1.datasource= newMTE;
datagrid1.datasource = newMTE
on DGV i can see at all the string[] properties
on the datagrid i can see them but as property type and not as a value
image example:
http://farm6.staticflickr.com/5519/10725217114_226ddd96c7_m.jpg
my collection have millions of rows, so i need an easy to process solution.
thank you all for the help
newMTE is a collection itself and your string[] are collection of items too (string array).
You can use something like Grouping or Show Row Details to show subrows of a row.
Examples here:
http://www.wpftutorial.net/DataGrid.html
this is a very very simple problem about XML deserialization.
I have here a simple XML (partial, for the sake of making this question small)
<iqu>
</items>
<item>
<installedsize></installedsize>
<softwareid>58907ba6-538b-424a-bfe4-98391857b1b1</softwareid>
<active>1</active>
<installdate>2013-06-03T21:02:07</installdate>
<installdisplaydate>Jun 3, 2013 9:02 PM</installdisplaydate>
<currentstate>0</currentstate>
<isinstalled>true</isinstalled>
<uninstallkeys>
<key type="software">
<![CDATA[Pidgin]]>
</key>
</uninstallkeys>
</item>
</items>
</iqu>
and I already made a class object for deserialization
using GalaSoft.MvvmLight;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UninstallHelper.Model
{
public class Model_W3i_InstallationData : ViewModelBase
{
public class Item : ViewModelBase
{
private string _installedsize = string.Empty;
public string installedsize
{
get { return _installedsize; }
set
{
if (_installedsize != value)
{
_installedsize = value;
base.RaisePropertyChanged("installedsize");
}
}
}
private string _softwareid = string.Empty;
public string softwareid
{
get { return _softwareid; }
set
{
if (_softwareid != value)
{
_softwareid = value;
base.RaisePropertyChanged("softwareid");
}
}
}
private string _active = string.Empty;
public string active
{
get { return _active; }
set
{
if (_active != value)
{
_active = value;
base.RaisePropertyChanged("active");
}
}
}
private string _displayname = string.Empty;
public string displayname
{
get { return _displayname; }
set
{
if (_displayname != value)
{
_displayname = value;
base.RaisePropertyChanged("displayname");
}
}
}
private string _runcommand = string.Empty;
public string runcommand
{
get { return _runcommand; }
set
{
if (_runcommand != value)
{
_runcommand = value;
base.RaisePropertyChanged("runcommand");
}
}
}
private string _installdate = string.Empty;
public string installdate
{
get { return _installdate; }
set
{
if (_installdate != value)
{
_installdate = value;
base.RaisePropertyChanged("installdate");
}
}
}
private string _installdisplaydate = string.Empty;
public string installdisplaydate
{
get { return _installdisplaydate; }
set
{
if (_installdisplaydate != value)
{
_installdisplaydate = value;
base.RaisePropertyChanged("installdisplaydate");
}
}
}
private string _versionid = string.Empty;
public string versionid
{
get { return _versionid; }
set
{
if (_versionid != value)
{
_versionid = value;
base.RaisePropertyChanged("versionid");
}
}
}
private string _ignoreversion = string.Empty;
public string ignoreversion
{
get { return _ignoreversion; }
set
{
if (_ignoreversion != value)
{
_ignoreversion = value;
base.RaisePropertyChanged("ignoreversion");
}
}
}
private string _campaignid = string.Empty;
public string campaignid
{
get { return _campaignid; }
set
{
if (_campaignid != value)
{
_campaignid = value;
base.RaisePropertyChanged("campaignid");
}
}
}
private string _productsessionid = string.Empty;
public string productsessionid
{
get { return _productsessionid; }
set
{
if (_productsessionid != value)
{
_productsessionid = value;
base.RaisePropertyChanged("productsessionid");
}
}
}
private string _installtype = string.Empty;
public string installtype
{
get { return _installtype; }
set
{
if (_installtype != value)
{
_installtype = value;
base.RaisePropertyChanged("installtype");
}
}
}
private string _updateurl = string.Empty;
public string updateurl
{
get { return _updateurl; }
set
{
if (_updateurl != value)
{
_updateurl = value;
base.RaisePropertyChanged("updateurl");
}
}
}
private string _offerid = string.Empty;
public string offerid
{
get { return _offerid; }
set
{
if (_offerid != value)
{
_offerid = value;
base.RaisePropertyChanged("offerid");
}
}
}
private string _classid = string.Empty;
public string classid
{
get { return _classid; }
set
{
if (_classid != value)
{
_classid = value;
base.RaisePropertyChanged("classid");
}
}
}
private string _currentstate = string.Empty;
public string currentstate
{
get { return _currentstate; }
set
{
if (_currentstate != value)
{
_currentstate = value;
base.RaisePropertyChanged("currentstate");
}
}
}
private string _isinstalled = string.Empty;
public string isinstalled
{
get { return _isinstalled; }
set
{
if (_isinstalled != value)
{
_isinstalled = value;
base.RaisePropertyChanged("isinstalled");
}
}
}
private string _uninstallinfo = string.Empty;
public string uninstallinfo
{
get { return _uninstallinfo; }
set
{
if (_uninstallinfo != value)
{
_uninstallinfo = value;
base.RaisePropertyChanged("uninstallinfo");
}
}
}
}
}
}
The question here is about this node in the XML I shown you (above)
<uninstallkeys>
<key type="software">
<![CDATA[Pidgin]]>
</key>
</uninstallkeys>
what is the correct way to deserialize this part?