Results 1 to 3 of 3

Thread: [RESOLVED] insufficient key column information for updating or refreshing----its urgent plz..

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2010
    Posts
    18

    Resolved [RESOLVED] insufficient key column information for updating or refreshing----its urgent plz..

    plz...i m working with vb6 and sql server 2000..!

    am retriving data to datagrid successfully..bt when ever i edit the data into datagrid it show this error (insufficient key column information for updating or refreshing)
    plz help me ..ma code is below..

    Code:
    Private Sub Form_Load()
    
    Con.ConnectionString = "DSN=ALELMDB"
    Con.Open
    Con.CursorLocation = adUseClient
    'Me.cmbYear.Value = Date
    
    
    End Sub
    Code:
    Private Sub ShowCreport()
    
    Me.DataG.Refresh
    Me.DataG.ClearFields
    myDate = Format$(Me.cmbYear.Value, "yyyy")
    
    strSql = "SELECT SPINF.GRNO, SPINF.CmbCat, TblMarks.Grno, TblMarks.CmbCat," & _
    "TblMarks.Sem,TblMarks.ryear, SPINF.STNAME as StudentName,  SPINF.INWHICHCLASS " & _
    "as Class, TblMarks." & Me.CmbCourse.Text & ",TblMarks.Punc,TblMarks.atten," & _
    "TblMarks.uniform,TblMarks.behav FROM SPINF INNER JOIN  TblMarks ON " & _
    "SPINF.GRNO =  TblMarks.GRNO AND SPINF.CmbCat =  TblMarks.CmbCat where " & _
    "Year(TblMarks.ryear)=" & myDate & " and SPINF.INWHICHCLASS='" & Me.cmbClass.Text & "'"
    
    'Debug.Print strSql
    
    DataQ.Open strSql, Con, adOpenDynamic, adLockOptimistic
    
    
    Set Me.DataG.DataSource = DataQ
    Me.DataG.AllowArrows = True
    Me.DataG.AllowUpdate = True
    
    Me.DataG.Columns(8).Alignment = dbgCenter
    If DataQ.RecordCount = 0 Then
    MsgBox ("Report card not generated yet.please contact the class teacher")
    End If
    is there ny other idea for updating recorde in datagrid..!
    thanx in advance

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: insufficient key column information for updating or refreshing----its urgent plz.

    Database tables should have a Primary Key, which is a field (or combination of fields) that is guaranteed to be unique for each row. You can set that up in the database itself (exactly how depends on the database system, but it is generally in the table design, and will be explained by the help).

    Any queries that are used for editing should include the Primary Keys.


    However, this situation is more complex because you have more than one table in the query, and it is possible that stops the ability to edit, as the way that the two tables are supposed interact is not something that can be easily automatically detected (eg: is the first table supposed to have one row that relates to multiple rows in the second table? ...or the other way around? ...or one row to one row? ...or many rows to many rows?)

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2010
    Posts
    18

    Re: insufficient key column information for updating or refreshing----its urgent plz.

    Pro solved thanx

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