The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > Web Programming > ASP / ASP.NET


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Tags: , , , , ,

Reply
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 07-09-2007, 07:38 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,109
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
Icon9 ASP.NET and mySQL

Hey! I finally can work and have fun with ASP.NET after long time figuring out how to setup everything for my workspace haha... Anyways, I'm now trying to create a registration form, but I don't know how to connect to the database and how ASP.NET handles mySQL commands... If anybody can help, I'll be appreciate it.. This is my current code for the form:

PHP Code:
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<
html xmlns="http://www.w3.org/1999/xhtml" >
<
head runat="server">
    <
title>REGISTRATION PORTAL</title>
    <
style type="text/css">
    
body {
        
text-aligncenter;
    }
    </
style>
</
head>
<
body>
    <
form id="registerForm" runat="server">
    <
div>
        <
table border="1">
            <
tr>
                <
td>Username:</td>
                <
td><asp:TextBox ID="username" runat="server"></asp:TextBox></td>
            </
tr>
            <
tr>
                <
td>Password:</td>
                <
td><asp:TextBox ID="password" TextMode="Password" runat="server"></asp:TextBox></td>
            </
tr>
            <
tr>
                <
td colspan="2"><asp:Button Text="Submit" OnClick="submitBtnClick" runat="server" /></td>
            </
tr>
        </
table>
    </
div>
    </
form>
</
body>
</
html
Nothing much other than CSS, HTML, and some ASP.NET fields.. just need to connect to the database on my localhost (installed), create the table, and insert the username and password each time they click submit.

I don't care about security right now, and just want to see how it works first

P.S I've searched over the web, and have not found good tutorial for it!

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!

Last edited by HelloWorld : 07-09-2007 at 08:10 PM.
Reply With Quote
  #2 (permalink)  
Old 07-10-2007, 05:41 AM
Lee's Avatar
Lee Lee is offline
PT Staff*
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: Blackpool, UK
Posts: 615
iTrader: (0)
Lee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enough
Check this out for connection strings:
ASP.Net Tutorial - Using MySQL with ASP.NET

To insert if its like php and other languages you would do something like:
$var = "INSERT INTO dbname (usr,pwd) VALUES ($usrtxtbox,$pwdtxtbox);"
mysql_query($var)

install phpmyadmin to your computer to make the databases it makes it much easier and later on if your making scripts with an install page you can learn the coded way (which you would learn in 10mins by that time), for my insert example where i put "(usr,pwd)" your tables column headings would have to be usr and pwd, "($usrtxtbox,$pwdtxtbox)" these 2 are the values of whats in your text box's im sure you know in asp how to put the value into a variable.

Some good words to include in your search:
mysql, ASP.NET, INSERT INTO, connection string, tutorial...Mix them up a little and you should get some results.

Hope it helps you a bit

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #3 (permalink)  
Old 07-10-2007, 07:09 AM
ccoonen ccoonen is offline
PT Staff
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Location: Wisconsin
Posts: 308
iTrader: (0)
ccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished road
Yup, definitely get the MySQL ODBC Driver... you might even be able to use the driver as a DataSource Provider and use the Strongly Typed Datasets... which will bring the power of Enterprise Manager right into .NET for you
Reply With Quote
  #4 (permalink)  
Old 07-10-2007, 08:30 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,109
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
Quote:
install phpmyadmin to your computer to make the databases it makes it much easier and later on if your making scripts with an install page you can learn the coded way (which you would learn in 10mins by that time), for my insert example where i put "(usr,pwd)" your tables column headings would have to be usr and pwd, "($usrtxtbox,$pwdtxtbox)" these 2 are the values of whats in your text box's im sure you know in asp how to put the value into a variable.
there's no way I can install it. Because my PC currently does not support .php files. Don't tell me to install XAMPP again, cuz I will get the same trouble as before XD
I personally use mySQL Query Browser and memorize the sql query commands. But I'm not sure if there's other optional way of myphpadmin & MS Access

I prefer to use mySQL than any microsoft DBMS

Quote:
you might even be able to use the driver as a DataSource Provider and use the Strongly Typed Datasets... which will bring the power of Enterprise Manager right into .NET for you
can you please clarify this for me? I have no clue what are you talking about... sorry, I'm too newbie at Server Side. ASP.NET is my Server Side programming that I'm learning now

Quote:
"Driver={MySQL ODBC 3.51 Driver};uid=YourUID;password=YourPWD;Server=YourSe rverIP;Option=16834;Database=YourDB;"
or, you can use:
"DRIVER={MySQL};SERVER=ServerIP; DATABASE=YourDB;USER=YourUID;PASSWORD=YourPWD; OPTION=3;"
I have no clue what he's saying, he just said that and it should run off XD

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!

Last edited by HelloWorld : 07-10-2007 at 08:37 AM.
Reply With Quote
  #5 (permalink)  
Old 07-10-2007, 09:00 AM
ccoonen ccoonen is offline
PT Staff
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Location: Wisconsin
Posts: 308
iTrader: (0)
ccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished road
load up visual studio, and add a folder called "App_Code" in the root of your website. Then right click on your app_code folder and click ADD. Add a Dataset and name it DataLayer. This is a GUI for creating data tables and queries. From here you can create a connectionstring (it will ask you right away) and will store it in the Web.Config file. Then you can create table Adapters that you can use later on. If you have a 'User' table in your database, then add a User Table adapter... then you can add queries like GetAllUsers or GetUserByUserID or GetUserByEmail, etc... all in the Table Adapter 'User'.

Then in your page code, you can bind your controls directly to the Table Adapters You can say...

Code:
Using UserAdapter as New DataLayer.UserTableAdapter
     Using UserTable as New DataLayer.UserTable = UserAdapter.GetAllUsers()
         DropDownListControl.DataSource = UserTable
         DropDownListControl.DataBind()
     End Using
End Using
- by using the using, it does the try catch, and dispose of the objects for you... it fills a datatable called UserTable from the UserAdapter's Query GetAllUsers... Have fun... this is pretty addictive once you get used to it
Reply With Quote
  #6 (permalink)  
Old 07-10-2007, 01:06 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,109
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
Quote:
This is a GUI for creating data tables and queries.
are you saying that we can control SQL from VS2005 ???
I'm kind of confused because I'm planning to use mySQL. Is this going to create msSQL ??? What do you use for your database..?

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #7 (permalink)  
Old 07-11-2007, 09:20 AM
ccoonen ccoonen is offline
PT Staff
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Location: Wisconsin
Posts: 308
iTrader: (0)
ccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished road
Yessir, VS has SQL fully integrated right into it you can even have multiple database connections open at once... tis pretty nice, hehe. I use MsSQL and Access and SQL CE but I think with the MySQL ODBC Driver you can use that as well
Reply With Quote
  #8 (permalink)  
Old 07-11-2007, 11:04 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,109
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
Quote:
Originally Posted by ccoonen View Post
Yessir, VS has SQL fully integrated right into it you can even have multiple database connections open at once... tis pretty nice, hehe. I use MsSQL and Access and SQL CE but I think with the MySQL ODBC Driver you can use that as well
Can I use SQL Query Browser of VS for mySQL too? I think I should try it out, I've been really busy these days with summer school.. sigh...

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #9 (permalink)  
Old 07-19-2007, 11:19 AM
ccoonen ccoonen is offline
PT Staff
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Location: Wisconsin
Posts: 308
iTrader: (0)
ccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished road
You might be able to - Not possitive, but VS's IDE is pretty dynamic.
Reply With Quote
Reply


Thread Tools
Display Modes

   Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 04:45 PM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50