I don’t have a problem, but sometimes I just love the way this system works.
I got the message {"Cannot convert object of type 'System.Int64' to object of type 'System.Data.SqlTypes.SqlInt32'."} {System.Data.DataException}

This was the command
System.Data.DataRow dr_Test0 = this.XML_DataSet.Tables[0].NewRow();

I also love how they obfuscate code. Finding the designer code:
private System.Data.DataSet XML_DataSet;
this.XML_DataSet = new System.Data.DataSet();
this.XML_DataSet.Tables.AddRange(new System.Data.DataTable[] {this.tbl_Test,//more tables}

this.tbl_Test = new System.Data.DataTable();
this.tbl_Test.Columns.AddRange(new System.Data.DataColumn[] {this.dataColumn1,//5 more columns}

The first data column definition:

this.dataColumn1.AllowDBNull = false;
this.dataColumn1.AutoIncrement = true;
this.dataColumn1.AutoIncrementStep = ((long)(-1));
this.dataColumn1.ColumnName = "TestID";
this.dataColumn1.DataType = typeof(System.Data.SqlTypes.SqlInt32);

AH HA! Because I asked it to be auto incrementing, I have to use long/Int64 for the field. The code of course doesn't know anything about the valid types while forcing a cast to long. And the only way I see the problem is because of a cast to long and I find the problem because of a runtime error. (AND NOT when I create the row, but when I try to get a copy of the row.)
Never mind I'll never produce over 2 billion rows of memory. (or that, I'm pretty sure 2 billion rows would wipe out my 4GB of virtual memory.)
Never mind I could probably declare the SQL server's identity field as small int and never blow up.

6 Years
Discussion Span
Last Post by Momerath
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.