how to count particular number of rows in a datagrid in Oledb?
138620
A DataGrid is not OleDb - it is something you get way downstream  from OleDb when you render the data to a Windows form or asp.net web page.\n\nAre you sure you don't have access to this data prior to rendering it? It would be far easier to grab a DataView off of a DataTable and use that for counting, than trying to count rows in a user interface element...\n\nA Windows Form DataGrid is much more iserializable style collection than an asp.net grid, and can be counted with an .Items.Count property or something close to that.
1046045
<%\n' Selected constants from adovbs.inc\nConst adOpenStatic = 3\nConst adLockPessimistic = 2\n\nDim cnnExcel\nDim rstExcel\nDim I\nDim iCols\n\n' This is all standard ADO except for the connection string.\n' You can also use a DSN instead, but so it'll run out of the\n' box on your machine I'm using the string instead.\nSet cnnExcel = Server.CreateObject("ADODB.Connection")\ncnnExcel.Open "DBQ=" & Server.MapPath("xl_data.xls") & ";" & _\n"DRIVER={Microsoft Excel Driver (*.xls)};"\n\n' Same as any other data source.\n' FYI: TestData is my named range in the Excel file\nSet rstExcel = Server.CreateObject("ADODB.Recordset")\nrstExcel.Open "SELECT * FROM TestData;", cnnExcel, _\nadOpenStatic, adLockPessimistic\n\n' Get a count of the fields and subtract one since we start\n' counting from 0.\niCols = rstExcel.Fields.Count\n%>\n<table border="1">\n<thead>\n<%\n' Show the names that are contained in the first row\n' of the named range.  Make sure you include them in\n' your range when you create it.\nFor I = 0 To iCols - 1\nResponse.Write "<th>"\nResponse.Write rstExcel.Fields.Item(I).Name\nResponse.Write "</th>" & vbCrLf\nNext 'I\n%>\n</thead>\n<%\nrstExcel.MoveFirst\n\n' Loop through the data rows showing data in an HTML table.\nDo While Not rstExcel.EOF\nResponse.Write "<tr>" & vbCrLf\nFor I = 0 To iCols - 1\nResponse.Write "<td>"\nResponse.Write rstExcel.Fields.Item(I).Value\nResponse.Write "</td>" & vbCrLf\nNext 'I\nResponse.Write "</tr>" & vbCrLf\n\nrstExcel.MoveNext\nLoop\n%>\n</table>\n\n<%\nrstExcel.Close\nSet rstExcel = Nothing\n\ncnnExcel.Close\nSet cnnExcel = Nothing\n%>
825400
Two words:\nStill Counting
95688
This can be done without too much trouble. Start by creating a text box on the page, then on the button click event, query the database based on the textbox content, for example if the box will contain a name or fragment of the name, then use this as your command text:\n"SELECT * FROM [table] WHERE [field] LIKE '%" + TextBox1.Text + "%'"\n\nThis query will return anything that starts with, contains, or ends with the text in box 1.  Then you display that data by binding the datatable the contains the new data with your datagrid. \n\nGood Luck!
53286
Replace "thetable" below with the name of your table...\n\nselect count(0)\nfrom syscolumns\nwhere id = (\nselect id from sysobjects\nwhere name='thetable'\n)\n;
672792
well to say..let me try to explain..\nfirst of we shall go with DataAdapter:\nDataAdapter lets u connect to the database with watever connecting string uve made n the command string that uve made...n gets the data from the database and stores this data in the DATASET.\nDataSEt is used to store the data fetched up by the DataADapter.\nWhereeas Databinding refers to binding the data, in whatever mode we require. This is mostly used when we've got to retrieve the data from many tables and shoe in the datagrid.\nMy code for the above goes like this:\n//This is to show the 'EMP' table details existing in the Oracle, using OLEDB Provider....shows the entire table details, after clicing the button1_click event...\n\nbutton1_click(..)\n{\nstrign strcon="provider=MSDAORA.1;User Id=scott;Password=tiger";\nstring strcom="select * from emp";\nOleDbDataAdapter adapter=new OleDbDataAdapter(strcom,strcon);\nDataSet dataset=new DataSet();\nadapter.Fill(dataset,"emp");\ndataGrid1.DataSource=dataset.Tables["emp"}.DefaultView;\n}\n\nThis may have some minor errors..please check out them\nHope u got what ive tryed to explain...
538436
Copy the code here: http://www.ozgrid.com/VBA/Sort.htm and follow the instructions in the middle of the page that begin: "To use this UDF push Alt+F11..."
421773
MS access will do that, \n\nlookfor help in excel for JET or OBDC
828970
dim db as database\ndim rs as recordset\ndim strSQL as string\ndim strA as string\ndim strB as string\ndim strC as string\n\nset db = currentDB\n\nstrSQL = "Select fieldA, fieldB, fieldC from Table1 where FieldD = fieldvalue"\n\nset rs = db.openrecordset(strSQL, dbOpenDynaSet)\n\nif not rs.EOF then\nstrA = rs!fieldA\nstrB = rs!fieldB\nstrC = rs!fieldC\n\nend if
1037204
Click on the link below and you can count them
404639
you count the number of times each figure appears (this has been asked many other times):\nfirst row: 1\nsecond row: one 1: 11\nthird row: two 1: 21\nfourth row: one 2 one 1: 1211\nfifth row: one 1 one 2 two 1: 111221\nsixth row: three 1 two 2 one 1: 312211\n\n... and so on ...
241790
C# is commonly used with SQL Server. Using this you simply need to add a reference at the top of your code:\nusing System.Data.SqlClient;\n\nThen use a SqlConnection, SqlCommand, and maybe a SqlDataReader. Set the connection up to reference your DB then create an SQL statement and execute the command. Then the DataReader will allow you to see each part.\nGood Luck!
443103
Try here http://www.gdatabase.com
567371
The best solution I've found so far is to just use a div tag like this:\n<div id="div1" style="OVERFLOW-Y: scroll; WIDTH: 500px; HEIGHT: 100px">\n//Insert datagrid here\n</div>\n\nThis will allow your datagrid to scroll.\n\n\nGood luck!
347074
256 columns, 65536 rows\n256 * 65536 = 16777216 total cells
800542
You could use GetTickCount\n\n'Put this in a module\nDeclare Function GetTickCount Lib "kernel32" () As Long\n\n'Use something like this in a form\nDim starttime As Long\nDim endtime As Long\n\nPrivate Sub CommandButton1_Click()\n\nstarttime = GetTickCount()\nEnd Sub\n\nPrivate Sub CommandButton2_Click()\nendtime = GetTickCount()\n\nMsgBox (endtime - starttime) / 1000 & " secs"\n\nEnd Sub
505781
Sub ChooseLastRow()\n\nRange("A1").Activate\nDo until activecell.value = ""\nActivecell.offset(1, 0).activate\nLoop\nactivecell.offset(-1, 0).EntireRow.select\n\nEnd Sub\n\n\nDo what ivpjennings suggested. MUCH more elegant. Completely forgot about that!\n\nBe careful with the xlLastCell. There's a bug in Excel. If you are working with your data and you delete a few rows, the xlLastCell will still be the last row of the original data set, not the updated last row after the deletions. Only after saving the file, will xlLastCell return the true correct last row.