Complex query (LIKE)

cesarfrancisco

Active member
Joined
Apr 3, 2007
Messages
33
Programming Experience
Beginner
VB.NET:
Dim myConn As New OleDbConnection
myConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\..\DB.mdb;Jet OLEDB:Engine Type=5"
myConn.Open()
Dim myCMD As New OleDbCommand
[COLOR=blue]myCMD.CommandText = "Select * from Table1 where FN LIKE '" & FNTextBox.Text & "%'"[/COLOR]
myCMD.Connection = myConn
Dim myAdapter As New OleDbDataAdapter
myAdapter.SelectCommand = myCMD
Dim ds As New DataSet
ds.Clear()
myAdapter.Fill(ds, "Table1")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "Table1"

How to save(update), delete the data displayed in the DataEntry form?
 
Last edited by a moderator:
Noting that your generated names are FillBy, FillBy5.. you really should consider naming them properly.. FillByLastName, FillByFirstName, FillByID

Microsoft naming convention for controls like textboxes are:

lastNameTextBox
firstNameTextBox

etc..

Try to avoid default names like TabControl1, Table1 - they tell other devlopers (like me, and other helpers) nothing - its called making code self documenting
 
Thanks. This area is new to me. I combed for info about this matter in vain.
I got 83 recommendation warnings. Do you have an idea (I am sure you do) how to remedy them?

These are representative samples of each kind.

1. Dialog Boxes (20):

Warning 4 CA1303 : Microsoft.Globalization : Backupinfo.InitializeComponent():Void passes a literal as parameter 1 of a call to Control.set_Text(String):Void. Retrieve the following string argument from a resource table instead: ' Backup Information' <<< this is the Title of the Dialog Box

Warning 57 CA1303 : Microsoft.Globalization : Form3.BackUp_Click(Object, EventArgs):Void passes a literal as parameter 1 of a call to ToolStripItem.set_Text(String):Void. Retrieve the following string argument from a resource table instead: 'Backup completed successfully.'

2. Form (15)

Warning 15 CA1303 : Microsoft.Globalization : Form1.InitializeComponent():Void passes a literal as parameter 1 of a call to Control.set_Text(String):Void. Retrieve the following string argument from a resource table instead: 'SYSTEM FUNCTIONS' <<< this is the Title of the Form

3. Labels on the Form (25)

Warning 41 CA1303 : Microsoft.Globalization : Form2.InitializeComponent():Void passes a literal as parameter 1 of a call to Control.set_Text(String):Void. Retrieve the following string argument from a resource table instead: 'Phone 1'

4. Casing

Warning 80 CA1709 : Microsoft.Naming : Correct the casing of member name 'txtBoxBackColorEnter'.
 
Is this an FxCop output?

Read the help text FxCop gives you.. It does a better job of explaining it than I will
 
It is a "VB 2005 Team" Test print out. These warning are the kind you were mentioning in your last post, like naming conventions, etc. I am just too new to this whole thing of programming although I am at it at least for 4 months now. I guess I am too slow (mildly speaking). I wish I could find a "readable" documentation, so I would not to bother other people with trivial questions.

Anyhow, I do appreciate that you take the trouble to answer.
 
It is a "VB 2005 Team" Test print out.

Team probably incorporates something like FxCop.. I dont know if right clicking the message would give an option for more help on the error, but heres a quick rundown:

Globalization problems = Your app is not easy to translate to another language. You use strings in the code:

myButton.Text = "Yes"

When you should refer to a table or collection that is all in one place:

myButton.Text = My.Settings.QuestionForm_YesButtonText


English.Config file said:
My.Settings.QuestionForm_YesButtonText = "Yes"
German.Config file said:
My.Settings.QuestionForm_YesButtonText = "Ja"
French.Config file said:
My.Settings.QuestionForm_YesButtonText = "Oui"
Spanish.Config file said:
My.Settings.QuestionForm_YesButtonText = "Si"

-

Naming case correction = its hard to say, because I dont know what 'txtBoxBackColorEnter' is. If it is a variable, then it is cased correctly, but it defies the convention of naming a control like:

backColorEntryTextBox
startProcessButton
statusReportListBox

For variables that are controls, the control type must come at the end of the name, forget all that Hungarin notion of cboMyCombo, txtMyTextBox, lstMyListBox.

If the member is a property, it must start with an uppercase letter

VB.NET:
Private ReadOnly myValStartsWithLowercase as String = ""
Property MyPropStartsUpperCase as String
  Get
    Return myValStartsWithLowercase 
  End Get
End Property
 
There's quite an intersting discussion ongoing about it in General Discussion, title "Naming conventions?" starter: pachjo
 
Back
Top