Results 1 to 12 of 12

Thread: [2005] VS.net 2005 BUG???

Threaded View

  1. #1

    Thread Starter
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    [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:
    1. Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
    2.         SuspendLayout()
    3.         cnn.ConnectionString = "Data Source=.\sqlexpress;Initial Catalog=MYDB;Integrated Security=True"
    4.  
    5.         If cnn.State = ConnectionState.Closed Then cnn.Open()
    6.  
    7.  
    8.         cmdGrade = cnn.CreateCommand
    9.         cmdGrade.CommandText = "SELECT DISTINCT * FROM tblEnrol WHERE SectionName = '" & cboSection.Text & "' AND SubjectName = '" & cboSubjectName.Text & "' AND YearLevel = '" & cboYearLevel.Text & "'"
    10.         daGrade.MissingSchemaAction = MissingSchemaAction.AddWithKey
    11.         dsGrade.Clear()
    12.         'dsSection.Clear()
    13.         'dsSubject.Clear()
    14.         daGrade.SelectCommand = cmdGrade
    15.         daGrade.Fill(dsGrade, "tblEnrol")
    16.         cnn.Close()
    17.  
    18.  
    19.  
    20.         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)}
    21.  
    22.         ''HideSheets()
    23.  
    24.         'bind fpspread1 to datasource
    25.         '1st Grading
    26.         FpSpread1.Sheets(0).DataSource = dsGrade
    27.         FpSpread1.Sheets(0).DataMember = "tblEnrol"
    28.  
    29.         'Create CellType and specify number decimal for 1st grading sheet
    30.         With FpSpread1.Sheets(0)
    31.             .DataAutoCellTypes = False
    32.             Dim num As New FarPoint.Win.Spread.CellType.NumberCellType
    33.             num.DecimalPlaces = 0
    34.             .Columns(12, 81).CellType = num 'column 12 to 81
    35.             .Columns(84, 85).CellType = num
    36.             .Columns(88, 89).CellType = num
    37.             .Columns(92, 93).CellType = num
    38.             .Columns(96, 97).CellType = num
    39.             .Columns(100, 101).CellType = num
    40.             .Columns(104, 105).CellType = num
    41.             .Columns(109).CellType = num
    42.  
    43.             'sort multi-column
    44.             .SortRows(0, FpSpread1.Sheets(0).RowCount, si)
    45.  
    46.         End With
    47.         FormatSpread()
    48.  
    49.         'bind FpSpread1.Sheets(1) to datasource
    50.         '2nd Grading
    51.         FpSpread1.Sheets(1).DataSource = dsGrade
    52.         FpSpread1.Sheets(1).DataMember = "tblEnrol"
    53.  
    54.         'Create CellType and specify number decimal for 1st grading sheet
    55.         With FpSpread1.Sheets(1)
    56.             .DataAutoCellTypes = False
    57.             Dim num As New FarPoint.Win.Spread.CellType.NumberCellType
    58.             num.DecimalPlaces = 0
    59.  
    60.             'for 2nd grading cell type
    61.             .Columns(135, 204).CellType = num 'Assignment to Total Score (A)
    62.             .Columns(207, 208).CellType = num 'Total Quiz to Total Score (Q)
    63.             .Columns(211, 212).CellType = num 'Total Rec to Total Score (R)
    64.             .Columns(215, 216).CellType = num 'Total Proj to Total Score (P)
    65.             .Columns(219, 220).CellType = num 'Total Speech to Total Score (SP)
    66.             .Columns(223, 224).CellType = num 'Total Reading to Total Score (RDG)
    67.             .Columns(227, 228).CellType = num 'Total Exam to Total Score (E)
    68.             .Columns(232).CellType = num 'Average
    69.         End With
    70.         FormatSpread1()
    71. End Sub

    vb Code:
    1. Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
    2.         'SuspendLayout()
    3.          dsGrade = CType(FpSpread1.ActiveSheet.DataSource, System.Data.DataSet)
    4.  
    5.         'Save the changes back to the database
    6.         Try
    7.             daGrade.Update(dsGrade.Tables("tblEnrol"))
    8.             dsGrade.AcceptChanges()
    9.             FormatSpread()
    10.             FormatSpread1()
    11.             formatspread2()
    12.             FormatSpread3()
    13.             formatspread4()
    14.             FormatSpread5()
    15.  
    16.             formatspread7()
    17.             formatspread11()
    18.  
    19.             MessageBox.Show("Changes are comitted to the database")
    20.         Catch ex As Exception
    21.             MessageBox.Show(ex.ToString)
    22.         End Try
    23.  
    24.         ' ResumeLayout()
    25.     End Sub
    Attached Images Attached Images   
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width