What you want in a simple example: http://www.aspnet101.com/aspnet101/aspnet/codesample.aspx?code=drtest2
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: donderdag 6 januari 2005 3:49 To: [email protected] Subject: [AspNetAnyQuestionIsOk] Accessing a record and the field values. In aspclassic I got each field in a recordset and assigned it's value to a variable. EASY. How can I accomplish the same thing in ADO.NET .... Ive been trying and I can't get it working. How I did it in ADO... Below............................. > 'create a SQL statement open the recordset > Dim strSQL > strSQL = "SELECT * FROM tblBTC" > > Dim objRS > Set objRS = Server.CreateObject("ADODB.Recordset") > objRS.Open strSQL, objConn > > > 'FIND THE RECORD WE WANT > Dim strShowRecord > > Do While Not (objRS.EOF OR strShowRecord) > If Not(StrComp(objRS("PlayingName"), strRecord, vbTextCompare) = 0) > Then > 'nothing > objRS.MoveNext > Else > strShowRecord = true > End If > Loop > > > > Dim strName, strPlayingname, strUserName, strPassword, strLocation, > strEmail, strAge, strIcq, strAim, strOccupation > Dim strBio, strPersonalInformation, strGamesPlayed, strConnect, > strProcessor, strRam, strVideocard > Dim strSoundcard, strHarddrive, strAdditionalsysteminformation, strPhoto, > strSystemPhoto, strDateJoined, strOS > > strName = objRS("Name") > strPlayingname = objRS("Playingname") > strUserName = objRS("UserName") > strPassword = objRS("Password") > strLocation = objRS("Location") > strEmail = objRS("Email") > strAge = objRS("Age") > strIcq = objRS("Icq") > strAim = objRS("Aim") > strOccupation = objRS("Occupation") > strBio = objRS("Bio") > strPersonalInformation = objRS("PersonalInformation") > strGamesPlayed = objRS("GamesPlayed") > strConnect = objRS("Connect") > strProcessor = objRS("Processor") > strRam = objRS("Ram") > strVideocard = objRS("Videocard") > strSoundcard = objRS("Soundcard") > strHarddrive = objRS("Harddrive") > strAdditionalsysteminformation = objRS("Additionalsysteminformation") > strPhoto = objRS("Photo") > strSystemPhoto = objRS("SystemPhoto") > strDateJoined = objRS("DateJoined") > strOS = objRS("OS") ADO.NET I have so far........... Probalby way off............. Ive tried a lot and commented a bunch of lines that didnt work etc..................... 'Open the Connection ------------------------------------- Dim objConn As OleDbConnection Dim objConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\btcNET\DB\belcherman.mdb" objConn = New OleDb.OleDbConnection(objConnString) objConn.Open() 'Response.Write("Connection OPENED <BR><BR>") 'Open the Connection ------------------------------------- 'Create a DataSet ---------------------------------------- Dim objDataSet As New DataSet 'Response.Write("objDataSet Created <BR><BR>") 'Create a DataSet ---------------------------------------- '---------- Get Playingname from Querystring ------ Dim strPlayingName As String strPlayingName = Request.QueryString("PlayingName") Dim strSQLstring As String strSQLstring = "SELECT * FROM tblBTC WHERE PlayingName LIKE '" & strPlayingName & "'" '-------------------------------- 'Create a DataAdapter ------------------------------------ Dim objDataAdapter As OleDbDataAdapter 'objDataAdapter = New OleDbDataAdapter("SELECT * FROM tblBTC", objConn) objDataAdapter = New OleDbDataAdapter(strSQLstring, objConn) objDataAdapter.Fill(objDataSet, "BTC MEMBERS") 'Response.Write("objDataAdapter Created and used to fill the the objDataSet with tblBTC <BR><BR>") 'Create a DataAdapter ------------------------------------ 'CODE =============================================================== 'tblBTC.DataSource = objDataSet 'tblBTC.DataBind() 'literal1.text = " HTML CODE " 'Want to add more: 'literal1.text &= " MORE HTML CODE " '<%# DataBinder.Eval(Container.DataItem, "PlayingName") %> Dim tblBTC As DataTable = objDataSet.Tables.Item("tblBTC") 'tblBTC.Rows.Item("PlayingName") Dim strTEST As String 'strTEST = tblBTC.Columns("PlayingName"). 'strTEST = objDataSet.Tables("tblBTC").Rows.Item("PlayingName").ToString() ' Iterate through the rows. 'Dim tblBTCDataRow As DataRow 'For Each tblBTCDataRow In tblBTC.Rows 'Console.WriteLine(tblBTCDataRow(0)) 'Next 'Dim column As DataColumn = dt.Columns("Description") 'Dim tblBTCDataRow As DataRow = tblBTC.Rows(0) Yahoo! Groups Links Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
