Hi, i dont know if this is the best place to post this, if there is a
better forum could you let me know.
My problem: i am new to asp.net and am using a MySQL database to hold
my information. I have the code:
************************************************** *****************
Dim myConnection As MySqlConnection
Dim myDataAdapter As MySqlDataAdapter
Dim myDataSet As DataSet
Dim strSQL As String
Dim iRecordCount As Integer
myConnection = New MySqlConnection("server=mysever; user id=myid;
password=mypassword; database=mydatabase; pooling=false;")
strSQL = "SELECT * FROM xbmembers;"
myDataAdapter = New MySqlDataAdapter(strSQL, myConnection)
myDataSet = New Dataset()
myDataAdapter.Fill(myDataSet, "xbmembers")
************************************************** *****************
I would like to be able to reference a single record from this table.
i.e. In asp i would have written
-----------------------------------------------------
WHILE NOT adoRS.EOF
IF UserName = adoRS("member_username") THEN
do something
END IF
adoRS.MoveNext
WEND
-----------------------------------------------------
What is the best way in which i could do this using asp.net accessing a
MySQL database?
Thanks Tim James 6 967
TheDude5B wrote: Hi, i dont know if this is the best place to post this, if there is a better forum could you let me know.
My problem: i am new to asp.net and am using a MySQL database to hold my information. I have the code: ************************************************** ***************** Dim myConnection As MySqlConnection Dim myDataAdapter As MySqlDataAdapter Dim myDataSet As DataSet
Dim strSQL As String Dim iRecordCount As Integer
myConnection = New MySqlConnection("server=mysever; user id=myid; password=mypassword; database=mydatabase; pooling=false;")
strSQL = "SELECT * FROM xbmembers;"
myDataAdapter = New MySqlDataAdapter(strSQL, myConnection) myDataSet = New Dataset() myDataAdapter.Fill(myDataSet, "xbmembers") ************************************************** *****************
I would like to be able to reference a single record from this table. i.e. In asp i would have written ----------------------------------------------------- WHILE NOT adoRS.EOF IF UserName = adoRS("member_username") THEN do something END IF
adoRS.MoveNext WEND -----------------------------------------------------
What is the best way in which i could do this using asp.net accessing a MySQL database?
Which DBMS you use shouldn't make a difference. Try this:
DataTable dt = ds.Tables["xbmembers"];
foreach (DataRow dr in dt)
{
if(!dr["member_username"].Equals(""))
{
//Do something
}
}
That's in C# though, I can translate it into VB if you need it.
> Hi, i dont know if this is the best place to post this, if there is a better forum could you let me know.
My problem: i am new to asp.net and am using a MySQL database to hold my information. I have the code: ************************************************** ***************** Dim myConnection As MySqlConnection Dim myDataAdapter As MySqlDataAdapter Dim myDataSet As DataSet
Dim strSQL As String Dim iRecordCount As Integer
myConnection = New MySqlConnection("server=mysever; user id=myid; password=mypassword; database=mydatabase; pooling=false;")
strSQL = "SELECT * FROM xbmembers;"
myDataAdapter = New MySqlDataAdapter(strSQL, myConnection) myDataSet = New Dataset() myDataAdapter.Fill(myDataSet, "xbmembers") ************************************************** *****************
I would like to be able to reference a single record from this table. i.e. In asp i would have written ----------------------------------------------------- WHILE NOT adoRS.EOF IF UserName = adoRS("member_username") THEN do something END IF
adoRS.MoveNext WEND -----------------------------------------------------
What is the best way in which i could do this using asp.net accessing a MySQL database?
Thanks Tim James
myDataSet.Tables[0].Rows[0]["member_username"].ToString()
Thanks, would you be able to translate it into VB please?
I should really start doing asp.net in C# as all the tutorials and
examples i find are all in C#
Thanks
TheDude5B wrote: Thanks, would you be able to translate it into VB please? I should really start doing asp.net in C# as all the tutorials and examples i find are all in C#
OK, I /think/ this should work:
Dim dt As DataTable = ds.Tables("xbmembers")
For Each dr As DataRow In dt.Rows
If (dr("member_username") <> "") Then
' Do something
End If
Next
Thats great thanks,
got everything working now. found some good information in the MSDN
library to so going to have a good read through all the pages there.
Thanks Again!
Tim This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sugapablo |
last post by:
Let's say I create a new record in a table like this:
mysql_query("INSERT INTO table (col1) VALUES ('example')",$conn);
....that had an auto-incrementing, unique identifying column named "ID"...
|
by: Phil Bitis |
last post by:
CREATE TABLE tbllayer (
LayerID int(11) NOT NULL default '0',
LayerSize int(11) NOT NULL default '0',
IceTypeID int(11) NOT NULL default '0',
Fingerprint char(16) binary default NULL,
PRIMARY...
|
by: fuimens |
last post by:
Hi,
With mysql-4.0.20, I have a problem inserting data with foreign key
references, MySQL saying ERROR 1216: Cannot add or update a child row:
a foreign key constraint fails
The message is...
|
by: khalidbaloch |
last post by:
hi : all Friend i am a new member of this comunity as well in php myqsl
i want learn that how to dispaly three or two record from a mysql table
for example ..
mysql table category has 21 columns,...
|
by: stantron |
last post by:
Setup: I only have one database with one table in it. The first page has a form that adds a record (w/ 6 fields in it) to the mySQL database's lone table via PHP. This works fine. I also have a PHP...
|
by: kcdoell |
last post by:
Good Morning:
I am using the following code to add new records to a table that is on my Sub Form. Below is the code that I placed in my Before Update event on my Sub Form:
Private Sub...
|
by: tkip |
last post by:
Hello everyone. I have been working on this DB for quite some time and still can't figure out a way to do what I want to do. It's a database that keep track of drawings and engineering change etc....
|
by: viki1967 |
last post by:
Not register double record in the DB MySQL
I have developed a simple procedure asp to upload files csv and record data in the table mysql database.
This procedure not register double record...
|
by: javediq143 |
last post by:
Hi All,
This is my first post in this forum. I'm developing a CMS for my latest website. This CMS is also in PhP & MySQL. I'm done with the ADD section where the Admin can INSERT new records in...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |