|
-
Aug 19th, 2008, 04:20 AM
#1
Thread Starter
PowerPoster
[2005] VS.net 2005 BUG???
Hi! I wonder if this is a bug... I kept getting these errors from time to time but I cant single out what's causing it.
My proj runs on a network and this happens when the user will click a save button to save records in the database (data table). Is this a bug?? if not, can someone please help me out in fixing these errors?
Attached are the errors I get and if it will help. this is how I accessed my database as well as how I save the records.
vb Code:
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
SuspendLayout()
cnn.ConnectionString = "Data Source=.\sqlexpress;Initial Catalog=MYDB;Integrated Security=True"
If cnn.State = ConnectionState.Closed Then cnn.Open()
cmdGrade = cnn.CreateCommand
cmdGrade.CommandText = "SELECT DISTINCT * FROM tblEnrol WHERE SectionName = '" & cboSection.Text & "' AND SubjectName = '" & cboSubjectName.Text & "' AND YearLevel = '" & cboYearLevel.Text & "'"
daGrade.MissingSchemaAction = MissingSchemaAction.AddWithKey
dsGrade.Clear()
'dsSection.Clear()
'dsSubject.Clear()
daGrade.SelectCommand = cmdGrade
daGrade.Fill(dsGrade, "tblEnrol")
cnn.Close()
Dim si() As FarPoint.Win.Spread.SortInfo = New FarPoint.Win.Spread.SortInfo() {New FarPoint.Win.Spread.SortInfo(1, True), New FarPoint.Win.Spread.SortInfo(2, True)}
''HideSheets()
'bind fpspread1 to datasource
'1st Grading
FpSpread1.Sheets(0).DataSource = dsGrade
FpSpread1.Sheets(0).DataMember = "tblEnrol"
'Create CellType and specify number decimal for 1st grading sheet
With FpSpread1.Sheets(0)
.DataAutoCellTypes = False
Dim num As New FarPoint.Win.Spread.CellType.NumberCellType
num.DecimalPlaces = 0
.Columns(12, 81).CellType = num 'column 12 to 81
.Columns(84, 85).CellType = num
.Columns(88, 89).CellType = num
.Columns(92, 93).CellType = num
.Columns(96, 97).CellType = num
.Columns(100, 101).CellType = num
.Columns(104, 105).CellType = num
.Columns(109).CellType = num
'sort multi-column
.SortRows(0, FpSpread1.Sheets(0).RowCount, si)
End With
FormatSpread()
'bind FpSpread1.Sheets(1) to datasource
'2nd Grading
FpSpread1.Sheets(1).DataSource = dsGrade
FpSpread1.Sheets(1).DataMember = "tblEnrol"
'Create CellType and specify number decimal for 1st grading sheet
With FpSpread1.Sheets(1)
.DataAutoCellTypes = False
Dim num As New FarPoint.Win.Spread.CellType.NumberCellType
num.DecimalPlaces = 0
'for 2nd grading cell type
.Columns(135, 204).CellType = num 'Assignment to Total Score (A)
.Columns(207, 208).CellType = num 'Total Quiz to Total Score (Q)
.Columns(211, 212).CellType = num 'Total Rec to Total Score (R)
.Columns(215, 216).CellType = num 'Total Proj to Total Score (P)
.Columns(219, 220).CellType = num 'Total Speech to Total Score (SP)
.Columns(223, 224).CellType = num 'Total Reading to Total Score (RDG)
.Columns(227, 228).CellType = num 'Total Exam to Total Score (E)
.Columns(232).CellType = num 'Average
End With
FormatSpread1()
End Sub
vb Code:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
'SuspendLayout()
dsGrade = CType(FpSpread1.ActiveSheet.DataSource, System.Data.DataSet)
'Save the changes back to the database
Try
daGrade.Update(dsGrade.Tables("tblEnrol"))
dsGrade.AcceptChanges()
FormatSpread()
FormatSpread1()
formatspread2()
FormatSpread3()
formatspread4()
FormatSpread5()
formatspread7()
formatspread11()
MessageBox.Show("Changes are comitted to the database")
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
' ResumeLayout()
End Sub
-
Aug 19th, 2008, 04:33 AM
#2
Re: [2005] VS.net 2005 BUG???
Attached images are too small. Can you please attach big images so that people can read it clearly.
-
Aug 19th, 2008, 05:40 AM
#3
Hyperactive Member
Re: [2005] VS.net 2005 BUG???
you need to look at frmHS lines 211 and 213, it appears to be something with your data but i coudn't make out all the info in the errors.
--"Tap Dancing On The Brittle Edge Of Sanity"--
-
Aug 19th, 2008, 07:21 AM
#4
Re: [2005] VS.net 2005 BUG???
Well, "DataTable Internal Index is Corrupt" and "Concurrency Violation" sound like an error in the database.
-
Aug 19th, 2008, 08:01 PM
#5
Thread Starter
PowerPoster
Re: [2005] VS.net 2005 BUG???
 Originally Posted by DirtyHowi
you need to look at frmHS lines 211 and 213, it appears to be something with your data but i coudn't make out all the info in the errors.
this the code where lines 211 and 213.
Code:
'Save the changes back to the database
Try
daGrade.Update(dsGrade.Tables("tblEnrol"))
dsGrade.AcceptChanges()
-
Aug 19th, 2008, 08:07 PM
#6
Thread Starter
PowerPoster
Re: [2005] VS.net 2005 BUG???
 Originally Posted by Jenner
Well, "DataTable Internal Index is Corrupt" and "Concurrency Violation" sound like an error in the database.
Im confused why this is displaying....If I close my form and try to enter values again and then save, i dont get the error....changes are saved and sometimes i get the error...
-
Aug 19th, 2008, 08:15 PM
#7
Re: [2005] VS.net 2005 BUG???
1) Here is a massive thread on the corrupted index error. I haven't read it all. Hope it helps. http://forums.microsoft.com/MSDN/Sho...77680&SiteID=1
2) Just taking a shot here: Are you trying to Update an auto-incremented field?
-
Aug 19th, 2008, 08:25 PM
#8
Thread Starter
PowerPoster
Re: [2005] VS.net 2005 BUG???
-
Aug 19th, 2008, 09:50 PM
#9
Re: [2005] VS.net 2005 BUG???
What he is asking is, are you perhaps unwittingly attempting to manually assign a value to an autonumber field in your update statement?
-
Aug 19th, 2008, 10:15 PM
#10
Thread Starter
PowerPoster
Re: [2005] VS.net 2005 BUG???
nope im not manually assigning value to autonumber field. As you can see in my post#5, I just use
Code:
daGrade.Update(dsGrade.Tables("tblEnrol"))
dsGrade.AcceptChanges()
-
Aug 19th, 2008, 11:30 PM
#11
Re: [2005] VS.net 2005 BUG???
You are using daGrade.Update(), but where in your code have you actually assigned an update command to daGrade?
-
Aug 20th, 2008, 02:32 AM
#12
Thread Starter
PowerPoster
Re: [2005] VS.net 2005 BUG???
 Originally Posted by MaxMayrhoferTemp
You are using daGrade.Update(), but where in your code have you actually assigned an update command to daGrade?
Im not sure what you mean but I have declared the following
Code:
Dim cnn As New SqlConnection
Dim cmdGrade As New SqlCommand
Dim daGrade As New SqlDataAdapter
Dim builder As New SqlCommandBuilder(daGrade)
Last edited by Simply Me; Aug 25th, 2008 at 06:34 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|