Link to home
Start Free TrialLog in
Avatar of RadhikaVyas
RadhikaVyasFlag for India

asked on

Asp.net with ms access update problem

Hi Everybody,
I am working with (ASP.Net with c#) Ms-Access database.
My problem is I need to edit My client profile.So I have put one hyperlink like 'Edit profile' which redirects to some aspx file...Here using Select query am displaying all his profile details in Page load...I have one update button now...In 'update button ' click i have written update query..My problem is My values are not getting updated when I debug also am getting previous values only which are loaded during my Page load...Please help me soon to solve this issue soon......
Avatar of plummet
plummet
Flag of United Kingdom of Great Britain and Northern Ireland image

Can you upload your code so we can work out where the problem might lie?
Possibly be needing a connection string in your web.config.
If the db is in the App_Data folder, something like this will do:
<connectionStrings>
    <remove name="ACE.OLEDB.12.0_cn"/>
    <add name="ACE.OLEDB.12.0_cn" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\thedbname.accdb" providerName="System.Data.OleDb"/>

  </connectionStrings>

Open in new window


Then if you are using a sql datasource with <updateparameters> or <insertparameters> defined, you will need to populate the parameters on the sqldatasource_updating and/or sqldatasource_inserting events.

As far as I am aware parameters are not supported for ACE.OLEDB.12.0, when using the configure datasource wizard, but they are supported, just not for the wiz.

So you could create an Access parameter query (stored procedure) that expects input params for updating or inserting.

Then in the  sqldatasource_updating and/or sqldatasource_inserting events you would populate your input params.
Protected Sub TheSqlDataSource_Inserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles TheSqlDataSource.Inserting

        e.Command.Parameters("ID").Value = intID
        e.Command.Parameters("Title").Value = strTitle
        e.Command.Parameters("ClientName").Value = strClientName
        etc ...

Open in new window

Alan
ASKER CERTIFIED SOLUTION
Avatar of RadhikaVyas
RadhikaVyas
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No objections to you closing the question, just like to say, it was a little difficult to determine the nature of the problem without any actual code to work with.

It was like we were working in the dark here ";0)

Glad you resolved the issue.
Success with your app!

Respectfully yours,
Alan
Avatar of RadhikaVyas

ASKER

No specific reason I found my mistake...Thanks for helping me...