|
You're welcome.
I assume you used the nested Ifs - I think it's worth looking at the ErrorProvider when you get a chance. It's really very flexible and makes it simple to do multi-field validations that would need complex code.
Regards
David R
|
|
|
|
|
Postscript to my previous reply.
Look up 'ErrorProvider Component' in VB help to see how it can be used.
Regards
David R
|
|
|
|
|
Why wont the following code give me any results, is 'said' a preserved word?
SELECT id FROM [table] where Contains ([fulltextcolumn], 'FORMSOF(INFLECTIONAL,aa) and FORMSOF(INFLECTIONAL,Said ) and FORMSOF(INFLECTIONAL,advocate)’;
while
SELECT id FROM [table] where Contains ([fulltextcolumn], 'FORMSOF(INFLECTIONAL,aa) and FORMSOF(INFLECTIONAL,bldg ) and FORMSOF(INFLECTIONAL,advocate)’;
Gives me the desired Results
Any thing am ready
|
|
|
|
|
You'll have to ask in the General Database forum. What you asked has nothing to do with VB.NET, so the level of expertise doesn't center around SQL in here.
|
|
|
|
|
SQL books is your friend. If it is, wrap said in [] like [Said]
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hello all, I have a problem here need someone to help here.
I'm doing a searching function from the database which is using MySQL5.0. A textbox(textbox2) is used for the user to search data by clicking the search button(Button1). The search return result will be display using a DataGridView1.
Well,when I search for the 1st time,it runs well with the result expected show at DataGridView1. But when I search for the second time,the result display is out of alliengment. It grows at a new row but shown on column2 and column3.It should be at column1 and column2.And beside that,the previous data is shown at the datagridview as well.
After test the above scenarios,I also found that after I search a data which is not inside the datatable.And try to search for something that available with result,the datagridview only display me the header of the column1 and column2 but no result.
I have try about 2hrs to find this solution,but I can't figure out how to solve this. I paste the search button code below,anyone can give me some solution? Sorry,please feel free to ask. I know its difficult to understand my poor english.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As String
Try
If Trim(TextBox2.Text) <> "" Then
x = TextBox2.Text.ToUpper
SQL = "SELECT Comp_Code,Comp_Name FROM company_detail WHERE Comp_Name LIKE '" & x & "%'"
ObjComm = New MySqlCommand(SQL, ObjMyConn)
ObjMyConn.Open()
ObjRead = ObjComm.ExecuteReader
If ObjRead.Read Then
ObjRead.Close()
DataGridView1.DataSource = Nothing
ObjAdapter = New MySqlDataAdapter(SQL, ObjMyConn)
ObjAdapter.Fill(ds, "Client_Comp")
dt = ds.Tables("Client_Comp")
dt.Columns(0).ColumnName = "Company Code"
dt.Columns(1).ColumnName = "Company Name"
DataGridView1.DataSource = dt.DataSet.Tables("Client_Comp")
DataGridView1.Refresh()
TextBox2.Clear()
Else
dt.DataSet.Tables("Client_Comp").Reset()
DataGridView1.DataSource = Nothing
MessageBox.Show("No such company stored.")
TextBox2.Clear()
End If
Else
MessageBox.Show("Please insert a search text into company column")
dt.DataSet.Tables("Client_Comp").Reset()
DataGridView1.DataSource = Nothing
DataGridView1.Refresh()
End If
ObjMyConn.Close()
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly)
Finally
ObjMyConn.Close()
End Try
End Sub
|
|
|
|
|
Your code makes no sense in certain sections.
SQL = "SELECT Comp_Code,Comp_Name FROM company_detail WHERE Comp_Name LIKE '" & x & "%'"
ObjComm = New MySqlCommand(SQL, ObjMyConn)
ObjMyConn.Open()
ObjRead = ObjComm.ExecuteReader
If ObjRead.Read Then
ObjRead.Close()
DataGridView1.DataSource = Nothing
You open a reader on a returned set, but if there is a result, you close the read immediately?? Then execute the same SQL to fill a dataset?? That's completely unnecessary. Just execute a fill on the DataSet, then bind the DataGridView to it. There's no need to check if something came back first.
|
|
|
|
|
Hello Mr Dave Kreskowiak, so happy someone help me to check about this.
Actually the reason why I did that is just to check the search data is available or not on the database. If its not available,I would not fill anything into the dataset and go into dataable anymore. Do you have any idea about what happen to the datagridview1? The result display at the datagridview1 is weird.
|
|
|
|
|
drexler_kk wrote: Actually the reason why I did that is just to check the search data is available or not on the database
This puts twice the load on the database. Just do it once and fill your DataTable. If the record Count in that table is greater than 0, you've got results.
Your setting up columns in the DGV on each pass of this search. You should only do it once, then forget about it since the columns in the DGV will not change.
|
|
|
|
|
You're doing multiple calls to the database which slays performance and is unnecessary (like the bank bailouts - zing!). Do the fill on the dataset and bind it. If there's any data, it'll be displayed.
If you want to check for the existence of data, check the dataset after the fill like so:
if dataset.tables(0).rows.count > 0 then
'we have data - hurray for us.
else
'wtf happened, there's nothing here.
end if
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Thanks Jon_Boy and Mr. Dave for the help. I have solve the problem here by changing what you recommend to me. It work well now.
|
|
|
|
|
When i resize tablelayoutpanel dynamically i want set rows and columns according to the resizing..
|
|
|
|
|
Use the Anchor property of the TableLayout panel to anchor the control to the sides of the form it's on, then set the column and row properties to either a percentage of the available space or specific valkues in pixels.
|
|
|
|
|
Hi friends,
Is there any way to reset or repower USB port,so that there is no need for repluging of device frequently to reset it.THanks in advance.
|
|
|
|
|
|
Restarting Windows would do it I guess.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Thursday, February 19, 2009 1:56 PM
|
|
|
|
|
Now that's thinking outside the box.
|
|
|
|
|
You can't box me, I'm a reference type
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Is it possible to reset from software rather than restarting windows?
|
|
|
|
|
|
Hi,
How can I change the bakcground color of a subitem in listview (after) adding the items? I tried to use "UseItemStyleForSubItems" for a specific list item to set its background and foreground color but it didn't change it.
Thanks.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
You have to set the UseItemStyleForSubItems has to be set to False in order for the subitems to render their own colors.
|
|
|
|
|
Help Me, Please..VERY URGENT
I have this cenario:
I have a form(NewcomplaintForm.vb that will collect informations for ComplaintTable(complaintid, ComplaintType, date, desc, status, recommendation, etc..); ComplainantTable(complainantid, last, first, etc..); OffenderTable(offenderid, last, first, etc..) DutyofficerTable(dutyofficerid, last, first, etc..) and insert data into these tables respectively.
when NewComplaint, check for complainant last and first name and identication, if they exist, update/modify and create a NewComplaint document. if not exist, create NewComplaint document.
I create the form in visual studio 2005, table in sql express..
I create a data set meaning 4 datasets since i have 4 tables..
I drag these dataset into the form..
Now I cannot get the insertion part done nor update nor checking for the complainant info before any new complaint create.
I need to accomplish the following:
1) CREATE A NEW COMPLAINT AND PRINT IT
2) SEARCH FOR A COMPLAINT BASED ON COMPLAINTID OR COMPLAINANTID, OFFENDERID
3) NEED TO MAKE THESE DATASETS WORK SO I CAN INSERT/UPDATE INTO THE TABLES
4) NEED TO HAVE COMPLAINTID SYSTEM DRIVEN
5) A COMPLAINANT CAN HAVE MULTIPLE COMPLAINTS
6) AN OFFENDER CAN HAVE MULTIPLE COMPLAINTS ON THEM
7) KEEP TRACK ON COMPLAINT STATUS AND RECOMMENDATION.
Please give me step by steps to get this done..
I am very new in this..
I Can be emaiedl at wnmichaud@yahoo.com
THANKS A LOT IN ADVANCE!!!!!
I'm standing by for a reply..
|
|
|
|
|
Well, the short answer is you have to update the tables, in the correct order, one at a time. The longer answer requires watching this[^].
|
|
|
|
|
Hi,I hope you can help me out here..I am in the hot seat.. For now I am unable to woatch the video..Can you guide me on what to do. Here is my problem, lets say i create a dataset for complaintDS and drag it onto the form, all the columns are there i can insert fine, but when i do dataset for the other tables on the same form, not all columns i want on the form for example Complainantid( int primary key for that table) i don't want it on the form, it should be autoincremented when i do the insertion. here lies my problem, complaintid, complainantid, etc cannot be nulled... Please help me I have one week to get this done... Look at my scenario, sketch me some few codes, i will be able to take it from there..Do it for just two tables(insert/update) and search and print the actual form data I will take it from that..
|
|
|
|
|