hi,
i want to display one table in a access database using datagrid.
i tried to do like this.

con.open constring
set rs=con.execute("command to select the table")
set datagrid.DataSource=rs


but it shows an runtime error like this:
RunTime Error '7004'

The rowset in not bookmarkable


wats' the reason... pls post simlified answers.
coz i'm a beginer.

try to use this


rs.open "command to select the table"
set datagrid.datasource = rs

regards
Ryan Riel

hi ryan,

the error is still there.

just see the error discription i have posted.
any idea

regards,
rahmath.

is the con.open is your connection?

yes bro!
here's the complete code.

dbConStr = Connection String
DataGrid = Name of MS DataGrid Control 6.0


con.open dbConStr
rs.open "select * from <tablename>", con, adOpenDynamic, adLockOptimistic
set DataGrid.DataSource=rs


here's the error no

RunTime Error '7004'
The rowset in not bookmarkable

please help me.

try this:

rs.open "select * from <tablename>", dbConStr, adOpenDynamic, adLockOptimistic
set DataGrid.DataSource=rs

regards
ryan riel

Tried that....

now the error is........

Runtime Error '91':
Object variable or with block variable not set

what i'll do....

pls..........

you should set your rs if your using adodb u can use this

set rs = new adodb.recordset
rs.open "select * from <tablename>", dbConStr, adOpenDynamic, adLockOptimistic
set DataGrid.DataSource=rs

Regards
Ryan Riel

'your code
dbConStr = Connection String
DataGrid = Name of MS DataGrid Control 6.0


con.open dbConStr
rs.open "select * from <tablename>", con, adOpenDynamic, adLockOptimistic
set DataGrid.DataSource=rs

'=======================
'modified version of your code
'=======================
'variable declaration

Private strSQL as string

dbConStr = Connection String
DataGrid = Name of MS DataGrid Control 6.0

strSQL = " select * from <tablename>"

'open database connection
con.open dbConStr

set rs = new Adodb.Recordset
rs.CursorLocation = AdUseClient
'only if you want to view records on datagrid
rs.open strSQL, con, AdOpenForwardonly, AdlockReadonly

'always check if there is a record
if rs.recordcount = 0 then exit sub
if rs.recordcount > 0 then
DataGrid.DataSource = rs
end if

sorry, the error is still there.
is there any property of datagrid that must be set while designing before executing?

regards,
rahmath.

check the references of your project.

hi, rahmath here,
i tried many time. reffered somany books. and sites too. just for this prob. Actually i'm not student. i'a job seeking person. i'm doin this project just to improve my ability. I have tried many ways those i got from site and books. but still i cant solve the problem.
belive me....
regards,
rahmath.

ah okay, try using the mshflexgrid control... it works for me.

i got it.
thanx..for all.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.