Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to UPDATE a table when the page loads with MySql and ASP.NET

Status
Not open for further replies.

SIMONI

IS-IT--Management
Aug 31, 2004
47
AU
Hi All,

I just started to re write an ASP site to ASP.NET 3.

I'm trying to update a MySql table when the page loads however the table is not being updated.

Here is what i'm doing:


Sub Page_Load(Source as Object, E as EventArgs)
DS1.ConnectionString = "driver={MySQL ODBC 3.51 Driver};SERVER=server;DATABASE=dddd;UID=ccc;PWD=xx;OPTION=3;"
Dim MySQL As String = "update static set hits=hits+1 where pagename ='artists'"


End Sub
</script>


I think the problem is that the update query is not being executed.


Can any one tell what do I need to do in order to fix it?

Thanks
Simon


 
what is DS1? After you define the sql statement you need to assign this to a command object and execute. there are lots of posts around the forums and on the web about ado.net. basically you need a connection and command object. optionally you may need a transaction and parameters.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Hi Simoni
I don't know how you've built your page but I've had the same trouble in the past, create a SQL database and try and use gridview and detailsview to look at the data and make changes/deletions and additions, only to find that the changes haven't been implemented. But recently I downloaded a video from which showed you how to use the DataSet to handle all your SQL connections and queries and apart from a few hic-cups when going live on the net, it's always worked perfectly. I've just looked at the site and theres a whole new set of videos to look at, might be worth taking a look.
Phil


I'm studying hard every day, so why is the learning curve appear to be heading downwards?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top