|
Vuyiswamb wrote: how am i going to return the user's required results if i dont use where in my SQl statement?
You said you want the statement to ignore certain parts of the WHERE clause. Since you can't do that, you have to REMOVE THOSE PARTS FROM THR WHERE CLAUSE.
By removing certain conditions from the WHERE clause, this:
SELECT someColumn1, someColumn2, someColumn3 FROM table WHERE condition1 AND condition2 AND condition3
becomes:
SELECT someColumn1, someColumn2, someColumn3 FROM table WHERE condition1 AND condition3
Vuyiswamb wrote: How dynamically, i dont understand.please post an example code or point to an article.
Check each part of the UI for a value entered by the user. If each condition, add it to the end of the SQL statement. Greatly simplified, it looks like:
Dim mySQLstring As String = "SELECT someColumn1, someColumn2, someColumn3 FROM table WHERE"
If someCondition Then
mySQLstring = mySQLstring & " condition1 "
End If
If someCondition Then
mySQLstring = mySQLstring & " AND condition2 "
This logic will NOT work!! If makes certain assumptions about the presence of the "WHERE" in teh SQL statement and doesn't check to see if an "AND" is required between conditions!!
|
|
|
|
|
Thank you veryt much Sir
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
|
|
|
|
|
Can anyone point me to a good article or examples where I can get some information on best practices for formatting the structure of my code. In particular, I am looking for a good examples that separates screen, business, and data logic and the types of functions found in each. I have searched the internet but seem to be coming up short.
Thank you
digicd
|
|
|
|
|
My Laptop has 512MB RAM, When my project running, time to time it raises unhandled exceptions. Called, ExecutionEngineException, NullReferenceException WIn32Exception and so on. But I ran it another PC which has 1GB RAM. In that PC not raised any errors, working fine.
What can be an error?
I am using VB.NET 2003 and MS Access 2003.
I have to present my project in my LAPTOP (512MB RAM) So what can i do?
Can anybody help me?
Dimuthu
Dimuthu
|
|
|
|
|
Hi,
the obvious answers:
1. borrow/rent another laptop
2. add memory (512MB is really not enough for typical development work)
3. reboot, don't run anything you don't need
4. Switch off networking, Wireless, Bluetooth, ...
5. remove everything you don't need from memory, including a lot of little handy
utilities such as:
Google Desktop Search
DVDLauncher
Acrobat Assistant
Microsoft Office QuickLaunch
Adobe Reader Speed Launch
etc.
You could try how much memory is needed on the working PC by adding stuff into memory
until it starts to fail.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
|
Most important thing is to check the code of your project. Very likely, your project causes memory leak (e.g. forget to dispose unused object). 512MB RAM should be OK for most applications running on Windows XP. Even if you can temporarily run your project on 1GB RAM computer, that computer will be eventually run out of RAM in the long run if you do not dispose unused object correctly.
petersgyoung
|
|
|
|
|
I am using vb.net 2005, I have a DataGridView in my form which displays big amount of data (50,000 rows and above), the first column is checkbox.
I want to select all the rows by clicking a button,
But the problem is with the for loop, it takes long time to select all the checkboxes because it will check one by one
Here is my code :
For i As Integer = 0 To Me.dgvData.Rows.Count - 1
Me.dgvData.Item(0, i).Value = True
Next
even I tried :
For Each row As DataGridViewRow In Me.dgvData.Rows
row.Cells(0).Value = True
Next row
but still takes a long time to select all
My question is, what is the fastest way to select all the checkboxes? Is there another way to select all the checkboxes except 'for loop' and 'for each loop'?
Appreciate your consideration
|
|
|
|
|
Farhad sharifi wrote: My question is, what is the fastest way to select all the checkboxes?
You already found it.
Farhad sharifi wrote: Is there another way to select all the checkboxes except 'for loop' and 'for each loop'?
Nope. Not in your code anyway. The only other method I could think of was using an UPDATE query to make the changes in the database and re-SELECT all those records. But that could take just as long as enumerating every row and selecting it yourself.
|
|
|
|
|
Have you tried to work on the datatable rather than the datagridview?
I wonder if begininit stop the display in the meantime
table1.BeginInit()
Dim dc as DataColumn = DataTable.Columns(0) ' lets precalculate the maximum
Dim NbRow as integer = Me.dgvData.Rows.Count
For i As Integer = 0 To nbRow-1
Table1.Rows(i).Item(dc)=false
Next
table.EndInit()
If begininit don't work you could try to clear the datasource and put it back at the end.
DataGridView.DataSource = nothing
DataGridView.DataSource = Table1
|
|
|
|
|
Hi,
I have two issues with the webbrowser control (2.0). Firstly, when i try to open gmail.com in it, it displays the action canceled page and says "Internet Explorer was unable to link to the Web page you requested. The page might be temporarily unavailable." while the same page opens in IE. What could be the issue.
Secondly, whats the licence agreement for redistribution of the control? I mean if I redistribute an application using webbrowser control 2.0 to a client, will I have to inform microsoft?
Thanks,
Ahmad
|
|
|
|
|
The control uses IE, which is part of Windows. So no, you don't need to worry about licensing.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I am using the infamous PrintForm method of VB6 because it is all that is needed for the application. It seems to work fine on all printers I have tried (dozens) except for every HP All-In-One printer/scanner/copier, where only part of the form is printed. The form consists of two types of sections. The first, where input data is entered, uses the TrueType MS Sans Serif font, command buttons, input boxes, etc. The second, where the resulting calculations are printed, is strictly text, using the monospaced Courier New font, since I needed to have columns of numbers lne up. On the HP All-In-Ones, the first type of section prints fine, but the second types are blank. This problem does not occur on HP LaserJets or DeskJets, or on other manufacturers devices. Has anyone else seen this problem? Is there a reason for it? Is there a simple fix? Thanks.
|
|
|
|
|
About the only thing you can do is try downloading the latest drivers for those printers. Since your code works for AMNY other printers, I'd say the problem isn't in your code.
I've also seen problems that manifested themselves using one driver, but not another. For instance, using the PCL6 or PostScript driver failed, but the PCL5e driver worked.
|
|
|
|
|
I have treeview and 2 listview on my form.And there is one menu with text multiple windows.If the multiplewindows menu is checked and 2nd listview.items.count > 1 then I am using the following lines to open a new window of the same form.
Dim newform as new frmscore
newform.show
Now I want to select the same treeview node on the new form which is selected on the form frmscore.And the same item should be selected on the new form which is selected on the form frmscore(First Window).
How I can solve this?
Thanks In Advance.
Ejaz
|
|
|
|
|
Expose a public method on your second form (frmscore) that finds and selects the item you pass in from the original form.
|
|
|
|
|
Thanks Dave for ur reply.
I tried to store the fullpath value of the original form in the variable and then expand the nodes of treeview on the new form and try to find the node with the same path but it is not working.How I can use the full path in loop to check all the nodes of the new form with the same path and if found then select that node.
Any Idea how to solve this.
Ejaz
|
|
|
|
|
Get the parent of the selected node and add it to a list. Get the parent of that node, add it to the list. Get the parent of that node, add it to the list... Until there are no more parents.
You pass this list to the other form. Now, in reverse order, you can build and open the path to the node you're looking for.
|
|
|
|
|
hi
Can Anyone tell me what functions can help in doing this or how can this be achieved using code ..
thanks ...
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want be always.. "
modified on Monday, December 17, 2007 11:07:29 AM
|
|
|
|
|
How do i add an activex control(say,i have the dll file of the plugin) into a .NET 2.0 Webbrowser (again i repeat its the .NET 2.0 one ,not the SHDocVw.dll one) . Please help .
Regards,
Vivek
|
|
|
|
|
The webbrowser control doesn't support plugins. The "plugin" interface would have to come from your app, not the control. This would seem, to me anyway, to be a ton of work to pull off as you'd have to implement the same plugin interface IE does (if you wanted to support existing IE plugins.)
|
|
|
|
|
I'm using VB 2003 to extract data from an excel file but I'm having trouble looping through one column to find duplicates and counting how may times a cell value is duplicated . If any one can please feel free to post.
Swish
|
|
|
|
|
You do not need to loop through the column. A more efficient way is to connect to your excel file with OledbConnection and issue a SQL group by statement.
petersgyoung
|
|
|
|
|
I'm connecting to the excel file but having trouble with the SQL group by statement.
I'm getting an error when the dataset is being filled by the OLEAdapter; An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in microsoft.visualbasic.dll
Below is a sample of the code:
Dim ex As String = "Provider=Microsoft.Jet.OLEDB.4.0; " & "data source=" & xlfile & ";" & "Extended Properties=Excel 8.0;"
Dim conn1 As New OleDbConnection(ex)
Dim dtset1 = New DataSet
Dim col1 As String = "sc_typname" '<-----Column to group by
Dim MyCommand1 As New OleDbDataAdapter("select * from [flnme$] Group By col1", conn1)
MyCommand1.Fill(dtset1)
DataGrid1.DataSource = dtset1.Tables(0)
conn1.Close()
Am I missing any information or how can resolve this error?
Swish
|
|
|
|
|
Please try this:
Dim MyCommand1 As New OleDBDataAdapter("select " & col1 & ", count(*) As [Count] from [flnme$] group by " & col1, conn1)
petersgyoung
|
|
|
|