1 Attachment(s)
[RESOLVED] The ConnectionString property has not been initialized..WHERE WHEN HOW?
HI ALL
i am using VBEXpress 2005
CONTROLS PRESENT
IDTextbox
DataGridView
Next_Button ( the value in the IDTextbox changes when i clik the next_button)
LOAD_GRID_button
I am able to connect to my m.db databse ( via code)
I am alos able to display the result of my SQL_Query into my DataGridView the first time (..LOAD_GRID_button--cliked 1st time)
but after going to the next value (CLICKING THE NEXT_BUTTON)
and if i try to load the grid again (Clik Load_Grid the 2nd time.. i get the message
"""""The ConnectionString property has not been initialized.""""""
if u need to see the code in my form pla see atachment query.txt
Re: The ConnectionString property has not been initialized..WHERE WHEN HOW?
Quote:
Originally Posted by Deepa7476
HI ALL
i am using VBEXpress 2005
CONTROLS PRESENT
IDTextbox
DataGridView
Next_Button ( the value in the IDTextbox changes when i clik the next_button)
LOAD_GRID_button
I am able to connect to my m.db databse ( via code)
I am alos able to display the result of my SQL_Query into my DataGridView the first time (..LOAD_GRID_button--cliked 1st time)
but after going to the next value (CLICKING THE NEXT_BUTTON)
and if i try to load the grid again (Clik Load_Grid the 2nd time.. i get the message
"""""The ConnectionString property has not been initialized.""""""
if u need to see the code in my form pla see atachment query.txt
Hi Deepa7476,
i think you need to rest the DataTable and clear the DataGrid...
VB Code:
sql_table.Reset()
sql_table.Dispose()
hope this helps,
Regards,
Re: The ConnectionString property has not been initialized..WHERE WHEN HOW?
hi Phenom
:(.. not working
Still same error
:(
Re: The ConnectionString property has not been initialized..WHERE WHEN HOW?
You've created the connection outside the method but you're disposing it inside. That means that once you've executed that method once the connection object has been destroyed. There's no need to be destroying those objects as it's probably more resource-intensive to keep creating and destroying them all than it is to just create them once and only destroy them when you close the form. If you really do want to destroy the objects at the end of the method then you'd have to be creating them at the start, so that each time you execute the method they will be recreated.
Re: The ConnectionString property has not been initialized..WHERE WHEN HOW?
hi JMC
thnx for the tip
i just moved
sql_con.open() to fORM_LOAD
AND its working great..
xcept a teeny bit of prob
My DataGridView is getting loaded the 2nd time also.. except that... its getting appended to the existing records
tried
VB Code:
DataGridView1.SelectAll()
DataGridView1.ClearSelection()
DataGridView1.DataSource = sql_dataset
DataGridView1.DataMember = "ID_Details"
sitll its getting apended..
i want to delete theresult of prev query and upload the new one..
Re: The ConnectionString property has not been initialized..WHERE WHEN HOW?
If you Fill the DataSet without Clearing it then it will still contain the old records.
Re: The ConnectionString property has not been initialized..WHERE WHEN HOW?
thnx jmc i added
VB Code:
Private Sub Button_NEXT_Click()
sql_dataset.clear()
end sub
working great now...
every time i clik next to to go to the next record..the DGV is empty and on loading everyintg is dispalyed as fresh data
thnks