Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have some data stored in a MS access database and im trying to search using vb.net as a task. Anyway i have a table called stock management but when i try to run code from vb it says cant find file etc? Need help

Here is the code im running:
VB
Sub cdb(ByVal ds As DataSet)
        'this establishes connection to db'
        sql = "SELECT * FROM Stock Management"
        con = New OleDbConnection(cs)
        con.Open()
        da = New OleDbDataAdapter(sql, cs)
        da.Fill(ds, "Stock Management")
        maxr = ds.Tables("stockmanagement").Rows.Count



da.Fill(ds, "Stock Management") here is where it says cant find the file? Whats the problem?
Posted
Updated 6-Feb-12 13:23pm
v2

Can you try
VB
sql = "SELECT * FROM 'Stock Management'"
 
Share this answer
 
Comments
alom_93 7-Feb-12 17:40pm    
nope not working
Sriram Chitturi 7-Feb-12 19:31pm    
Can you provide the code including the connection string? also provide the "Stock Management" table layout.
alom_93 8-Feb-12 17:44pm    
thanks but now fixed
VB
sql = "SELECT * FROM [Stock Management]"
 
Share this answer
 
Comments
alom_93 7-Feb-12 17:40pm    
gives an error saying syntax error
alom_93 8-Feb-12 17:44pm    
fixed although u provided the baseline for my mistake so thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900