mysql and .net

Hi there,

i am new to .net and i am trying to setup a simple form. I am an open source person and what i am asking can be done easily using php and mysql; but i need to know how to do this in .net project asap.
i have three forms;
form1 submit to the database and redirect to form2 and form2 submit to the database and redirect to form3.
i want to grab mysql last inserted id from form1 to form2 while redirecting and pass it via the url. i am able to select from the database, but i don't know how to assign it to a variable; here is what i have so far:
str2 = "select last_insert_id() as personID"
Dim rd1 As OdbcDataReader
Dim cmd1 As New OdbcCommand(str2, myConn)
rd1 = cmd1.ExecuteReader
Response.Redirect("http://localhost/ecommerce/product.aspx?id=" & personID)

second question is how do i declare my database connection in the web.config so that i can use it as an include file in all my .aspx.vb files?
thanks for all your responses.
8/5/2004 6:46:47 PM 1929 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 18

I think I know the answer to your first question, but will need to get back with you on that.

Your #2 question:
I put the connection string in my global.asax.vb:
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
'Create Database Connection String
Dim globalConnStr As String
globalConnStr = "driver={MySQL ODBC 3.51 Driver};"
globalConnStr = globalConnStr + "server=localhost;"
globalConnStr = globalConnStr + "port=3306;"
globalConnStr = globalConnStr + "Stmt=;"
globalConnStr = globalConnStr + "uid=root;"
globalConnStr = globalConnStr + "pwd=;"
globalConnStr = globalConnStr + "database=smfr_wildland;"
globalConnStr = globalConnStr + "Option=3;"
'Assign Database Connection String To
'global connection object
Application("globalConnStr") = globalConnStr
End Sub
then when i need it I simply refer like this:
DBConn = New System.Data.Odbc.OdbcConnection(Application.Item("globalConnStr"))
Adding application settings to web.config are similar:
<add key="globalConnStr" value="Provider=MySQLProv;SERVER=;DB=database;UID=user;PWD=;PORT=3306" />
Then reference by:
DBConn = New System.Data.Odbc.OdbcConnection(ConfigurationSettings.AppSettings("globalConnStr"))
8/12/2004 4:00:05 AM

Similar Artilces:

Currently have a site coded in PHP but the customer wants to go to .NET. Can I use the existing MySQL DB or am I required to use MSSQL? Thanks, Ken Check out this forum which is specialized for this kind of questions: ASP.NET MySQL forumBart De Smet [MVP] Visit,

System.Net.Sockets.SocketException with MySQL Connector.NET
Hi. I already tried many things and spent already 2 days without any success. Please help or I'll hang myself.I am using MySql.Data.dll  ver. (runtime v2.0.50727) from my project (library). It works great if i use it from WindowsApplication but once i use it same way in WebApplication, it keeps throwing: The attempted operation is not supported for the type of object referencedException Details: System.Net.Sockets.SocketException: The attempted operation is not supported for the type of object referenced .. AsyncResult ias = socket.BeginConnect(endPoint, null, null);.. (or w...

------=_NextPart_000_0026_01C30A6E.486AE070 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Anyone run into this problem=20 $mysql->query(q{ INSERT INTO dbname (table_name) VALUES ( $var ) }); The problem is, when I assign a value to a $var that value is ignored in = the SQL statement. Ive tried every operator I know to get it to look at = it and accept the value as input into the DB. Ive tried=20 ( '$var' ) ("$var") ("\$var") ([$var]) ({$var}) Any ideas ? Kind regards...

------_=_NextPart_001_01C6429F.D89AA417 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, Net::LDAP Net::LDAPS Is there a possible to LDAP bind with an encrypted (SHA, SSHA, CRYPT, ....) password? I don't like to write the secret password to the perl file. Best regards Barbara Wilbert ------_=_NextPart_001_01C6429F.D89AA417-- Wilbert Barbara (CI/OSI) * wrote: > Hello, > > Net::LDAP > Net::LDAPS > > Is there a possible to LDAP bind with an encrypted (SHA, SSHA, CRYPT, > ......

New to MySQL with .net
I have usually only work with mssql for but for this project I am using mysql.  After doing some reading it seems one of the best ways to connect to mysql is throught the MySQL Connector/Net.  I have downloaded and installed this and for the most part it is working.  I can connect to the database and pull simple select statements.  I am now trying to write data and I get an error.  The error is:MySql.Data.MySqlClient.MySqlException: Parameter '@value1' not found in collectionPlease see the code below for how I am trying to insert data into the database.  Th...

I want to use VB.NET with a MySQL database. I have NO idea what the consqeuences are with regard to connection strings etc. Does anyone have good examples of how to set all this up?please mark answers as 'Answered' and post back solutions when you figure stuff out that isnt in the post already. Just to see if it is helpful to you. Regards,Wilson Ng @Hong Kong SAR...

Mysql Conector Net
I install the Mysql Conector Net , How i can use this  to add a database conection in Visual Web DeveloperThanks Try this link and click on configuring ObjectDataSource and see if you can use MySQL as a data source and try the same with SqlDataSource.  Hope this helps regards,Gift Peddie However major features are only supported by sql only, but ObjectDataSource can be connected to objects which interact with mysql server and here is the small framework i created for the generic object database connectivity

Mobile.Net and mysql
Hi, I am totally new to though i worked with asp but .net is very new to me. I want to learn how to connect a mysql database using sql= "select * from database where field = '" & Querystring & "'" how to use in  Please Please help!  Thanks very very much! Shnawer shnawer:I am totally new to though i worked with asp but .net is very new to me. I want to learn how to connect a mysql database using sql= "select * from database where field = '" & Querystring & "&...

Transations with MySQL and .NET
Hello I'm trying to build a WebSite with a MySQL database. Several of the database operations will be included in a Transaction. As perference I would like to use the TransactionScope, but, for now I just want  that I could rollback my database transaction in manual mode. This is my code: MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(connectionString);conn.Open(); MySql.Data.MySqlClient.MySqlCommand cmd = conn.CreateCommand();MySql.Data.MySqlClient.MySqlTransaction myTransaction = conn.BeginTransaction(); cmd.Connection = conn;cmd.Transac...

Installation of Net::MySQL
My installation of RedHat Linux server 5.3 came with PERL 5.8. I updated my version of PERL to 5.12, and my copy of PERL resides at / root/localperl/bin/perl I've attempted to install DBD, DBI and Net::MySQL and all failed. It is possible that the reason why the installs are failing is common to all three, but I do not know that as a fact, so I am asking you to look over and respond as to what I may be doing wrong in the installation of Net::MySQL. I'm following the instructions that come with Net::MySQL - Pure Perl MySQL network protocol interface. Any attempts to use ...

MySQL with VB.NET?
This is getting frustrating because i want to connect to mysql databases to i tried looking on the net but all they ask you is too type all those commands in? i understand i have to get the net connector thingy but i cant just press "add new connection" in and just click on mysql? can someone help me?  Err, coding generally involves typing...If you are using VS.NET you can try the Server Explorer.  I've never used it, so I don't know what it does, but it seems like perhaps what you want.HTH, rchern.Churned Ajax ToolkitPlease choose "Mark as Answ...

Net::MySQL hangs
Strange problem. I can get the example program to work with MySQL but I can't get it to work with my other table. In hpux where would i find the error messages generated by this? Here is the code $ cat #!/usr/bin/perl # a test of querying the dnstable on database dev use strict; use Net::MySQL; my $mysql = Net::MySQL->new( hostname => 'localhost', database => 'dev', user => 'dev', password => 'passwrd', ); # now setup query into database print " befo...

Differences between .net 1, .net 1.1, .net 2.0 and .net 3.0
Hi, This seems to be a common question, but i havent got an answer yet:(Can, any one please explain me the differences between these versions.If you keep your feet firmly on the ground, you'll have trouble putting on your pants! Have a look into this links Rajawww.iGold.inDon't forget to click "Mark as Answer" on the post that helped you. This credits that m...

To .NET or not .NET, that is the question
I'm running WinXP pro 32-bit, meaning I've got the version 1-dot-something of .NET that XP came with. I've been looking for various softwares, and more and more often come across .NET version 2 being prerequisite. No urgency for me re. my questions to this group - so far I have just decided to hit the red X on those download pages - but the desire for this newer version of .NET seems to be growing for me. Firstly, according to my (limited) research, newer .NET versions are inclusive of the previous ones, and the current version seems to be 3.5. So if I go for i...

Web resources about - mysql and .net -

MySQL :: The world's most popular open source database
“MySQL's reliability and speed have helped us develop software that maximizes the availability and performance of enterprise telephony networks, ...

MySQL :: Il database open source più diffuso al mondo
Skip navigation links Il database open source più diffuso al mondo Contatta un rappresentante MySQL Login - Registrazione Download (GA) ...

MySQL Performance Blog
Percona's blog about MySQL performance optimization and scalability, InnoDB, XtraDB, and XtraBackup

MySQL - Wikipedia, the free encyclopedia
5.5.27 / August 2, 2012 ; 29 days ago ( 2012-08-02 ) The MySQL development project has made its source code available under the terms of the ...

It is that time of the year, again: Percona Live is the name of this years MySQL conference in the Santa Clara Hyatt Regency. is ...

MySQL Consulting and NoSQL Consulting: MySQL DBA
... to the problem that doesn't include companies having to buy new software tools or even an all-new database: With the right expertise, MySQL ...

MySQL Bugs
Portions of this website are copyright © 2001, 2002 The PHP Group Page generated in 0.013 sec. using MySQL 5.5.16-enterprise-commercial-advanced-log ...

MySQL :: Developer Zone
"The Documents contained within this site may include statements about Oracle's product development plans. Many factors can materially affect ...

MySQL Forge :: Dashboard
© 1995-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2012, Oracle Corporation and/or its affiliates. Content reproduced on this site is the ...

Facebook, Google, LinkedIn, Twitter Team Up On WebScaleSQL To Tackle MySQL Challenges
Facebook, Google , LinkedIn , and Twitter face similar challenges in working with open-source database MySQL , and Thursday, the four companies ...

Resources last updated: 12/5/2015 12:24:24 PM