|
The size of text file is about of 10 to 15 MB.
which may or may not contain numeric value.
(the demo file i m working on contains numeric data.)
help everyone
|
|
|
|
|
Hi All, its me who is Stucked now
am using vb 2003. am searching the grid, i have a normal Search and a Advanced Search. my normal search is working fine and return the required results. on my advanced Search and using textboxes to search the grid. The following code is the SQl statement passed to the adapter.
SELECT Primary_ID, Boundary_area, Attrib_Code, Lis_Key, Func_Key, Actual_Extent, Improved_Value, Site_Value, Purchase_price, Purchase_date, prop_id, confidence_score, fin_ls_prediction, new_lis_key, new_func_key FROM Property_mass WHERE (SUBSTRING(Lis_Key, 1, 4) = @Num_key) ANd (SUBSTRING(Attrib_Code, 1, 1) = @Pair1_1) And (SUBSTRING(Attrib_Code, 2, 1) = @Pair1_2)
And the Following code is the code in my Search Button.
Dim strErrorMsg As String
Dim strerror As System.Data.SqlClient.SqlError
Try
SqlDataAdapter2.SelectCommand.Parameters("@Num_key").Value = CStr(txtlisSearch.Text)
SqlDataAdapter2.SelectCommand.Parameters("@Pair1_1").Value = CStr(pair1_1.Text)
SqlDataAdapter2.SelectCommand.Parameters("@Pair1_2").Value = CStr(pair1_2.Text)
'Filling the Dataset
SqlDataAdapter2.Fill(Pairone1)
If Pairone1.Tables("Property_Mass").Rows.Count = 0 Then
MessageBox.Show("Property with Such Code in this pair was not Found")
Else
Pairone1.Clear()
SqlDataAdapter2.Fill(Pairone1)
DataGrid1.DataSource = Pairone1
End If
Catch ExSQL As System.Data.SqlClient.SqlException
''''All this will trap all data Problems and Network if available
For Each strerror In ExSQL.Errors
Next
Select Case strerror.Number
Case 17
strErrorMsg = "Missing server"
Case 4060
strErrorMsg = "Missing database"
Case 18456
strErrorMsg = "Missing user name or password"
Case Else
strErrorMsg = strerror.Message
End Select
MessageBox.Show(strErrorMsg, "SQL Server Error: " & strerror.Number, MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch ExcpInvOp As System.InvalidOperationException
MessageBox.Show("Close the connection first!", "Invalid Operation", MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch Excp As System.Exception ' generic exception handler
MessageBox.Show(Excp.Message, "Unexpected Exception", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
In this code, there are Errors,but the bring incorrect results. i tried the SQL statement passed to the adapeter in SQl and replaced the variables with values and it working fine, now from my above code, i think the Problem should be here
SqlDataAdapter2.SelectCommand.Parameters("@Num_key").Value = CStr(txtlisSearch.Text)
SqlDataAdapter2.SelectCommand.Parameters("@Pair1_1").Value = CStr(pair1_1.Text)
SqlDataAdapter2.SelectCommand.Parameters("@Pair1_2").Value = CStr(pair1_2.Text)
'Filling the Dataset
SqlDataAdapter2.Fill(Pairone1)
but i cant understand how.So i have some questions.
1: IF the user has not inserted the value in e.g pair1_1 textbox, can it be ignored and run the query based on what it had been supplied.meaning cant we make this values optional?
Vuyiswa Maseko
|
|
|
|
|
Vuyiswamb wrote: IF the user has not inserted the value in e.g pair1_1 textbox, can it be ignored
The only way to ignore the condition is it's removed from the SQL statement's WHER clause.
Vuyiswamb wrote: .meaning cant we make this values optional
SQL doesn't support optional parameters.
You basically have to generate the SQL string dynamically, adding just the conditions that are supplied by the user.
|
|
|
|
|
|Dave Kreskowiak wrote
The only way to ignore the condition is it's removed from the SQL statement's WHER clause.
how am i going to return the user's required results if i dont use where in my SQl statement?
|Dave Kreskowiak wrote
You basically have to generate the SQL string dynamically, adding just the conditions that are supplied by the user.
How dynamically, i dont understand.please post an example code or point to an article.
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
|
|
|
|
|
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.)
|
|
|
|
|