Use SQL Queries With LIKE, @parameters, And % Wildcards?

Feb 22, 2012

I am using a database in Visual Basic 2010 displayed through a DataGridView. Through the DataGridView's "add query" option, I am writing these queries. My goal is to have partial search entries show up (ie if the entry is "Lewis" then it should be among the entries returned if "Le" is in the textbox.)

SELECT * FROM Table WHERE Surname LIKE '%' + @Surname + '%'

I am using the above query and it only returns exact matches despite the LIKE operator. Partial entries never show up despite the presence of the wildcard % symbol. It's as if the whole thing is being treated as an equal sign.What should I do? Is it a problem with the SQL itself or does VB's "add query" maker simply have such limited capabilities?

View 2 Replies


ADVERTISEMENT

VS 2008 Using Variables / Parameters In Sql Queries?

Sep 20, 2011

I am using Visual Basic 2008 / MYSQL

Basically i have 2 tables in mysql called Data and products

The first sql query i want to do is something like this to scroll through the recordset of products and bring back information;

dbquery.commandtext = "select quantity, sku, condition from products"

But then what i want to do is bring back information from the Data table based on the sku and condition of the first sql?

so it would be something like this

subquery.commandtext = "select lowestprice from data where sku = *SKU FROM FIRST TABLE* and condition = *CONDITIONFROM FIRST TABLE*"

View 6 Replies

LINQ Queries - Combine The First 3 Queries Into A Single Query And Place In A List?

Jan 6, 2010

I am writing a message system on my server, the xml is something like this

<xml>
<entry>
<sender>[code]....

my problem now i guess is 2 fold, i wish to combine the first 3 queries into a single query and place in a list or a collection or is there a way to do this with a single query that will give me my desired result?

View 1 Replies

Copy Files Using Wildcards

Jul 24, 2010

i want to copy all the files in a directory with an extension e.g .exe or maybe all them files *.*I searched on google and found this on MSDN But it doesn't work when i type *. or *.* or *.exe into the textbox and there is files in that folder.[code]

View 7 Replies

Match A Two Strings While Using Wildcards In Them?

Jul 16, 2009

i am pulling data line by line from a PPML what i need to do is: If "current line" matches my string then write that line to a new file

that part I have down my only issue is, is that the "current line" has filenames with in it that change constently i would like to be able to do something like a string with wildcards in it : "<currentline>src=""*""/>" but this does not seem to work Do i need to do an index with conditions or is there a different way if i do need to do an index how would i go about doing that in vb .net for studio 2008

View 1 Replies

Using Wildcards Or Specifying Multiple Objects?

Nov 15, 2011

i have a bunch of radio buttons which can have different text displayed depending on whats retrieved from the database.however i want to add code that hides any radio button that would have a 'zero' retrieved from the database.so far this is the code i was coming up with, without getting into the nitty gritty of the actual database queries

If RadioButton1.Text = Me.HWExamsDataSet.DSExamTextA.Rows.Item.tostring = 0 Then
RadioButton1.Visible = False
End Ifabase entries or queries.

it looks like it may work...but is there a way to automate it so that i can put in a reference to ANY radiobutton like radiobutton(*).text? or a bunch of buttons if need be.i know theres a way to specify additional items to a given command...just can't remember if its curly brakets etc.

View 2 Replies

VS 2008 How To Search By Using Wildcards

Sep 11, 2009

I have to provide the app users, a way to search by both regex and wildcards.I've already implemented the regex option, but how to provide a search by wildcards?

View 7 Replies

Wildcards In Filename Searches

May 8, 2009

I am trying to return a filename without the extention, to keep things simple, lets just say I want it to go to a MsgBox.[code]The only thing I am getting is a * in the msgbox. I though that strings supported wildcards?

View 6 Replies

Wildcards In Replace Function?

Nov 5, 2010

i created a DatagridViewNumericUpDownColumn but i got error message Cannot access a disposed object. Object name: 'NumericUpDown'when i closed and reopen the form. It shown You are not authorized to perform this action.how can i get access to view this thread?

View 4 Replies

Finding Single File Using Wildcards?

Mar 3, 2012

I'm using Visual Basic Professional 2010, I have two directories of XML files. The naming convention in directory one is a user's name, a six digit date and ending in ".xml_CREATE.xml". So, I perform some work on a file in directory two. During the course of that processing I discover that a file exists in directory one called "Mike" an unknown six digit date and ending with ".xml_CREATE.xml", so while I have no way to know the date, I know it exists and would look something like Mike030312.xml_CREATE.xml. So, now I want to load that file as an XElement that I will eventually incorporate into an XDocument, so I need to perform a Load similar to:
myXMLFile = XElement.Load(My.Settings.XMLDir & "" & Mike030312.xml_CREATE.xml),
However, since I don't know the date, I need to insert wildcards at that spot. How do I make that happen?

View 13 Replies

Searching And Deleting Files (using Wildcards)

Jun 29, 2009

how to even start a code project of this sort but here it goes... I have an external Hard Drive with some music. My itunes makes duplicates of all my songs so this is what i have.

Dance.mp3
Dance 1.mp3
Dance 2.mp3
Dance 3.mp3
Party.mp3
Party 1.mp3
[Code]...

What I want to do is have the program search the files and delete all files that have a duplicate with a number behind it... Now I would use windows search but some of the songs are like 1001.mp3 or 1001 1.mp3... I want it to look like this when i get done (from the above):

[Code]...

View 1 Replies

VS 2010 Using Wildcards To Copy Files?

Jul 13, 2010

Ok i want to copy all the files in a directory with an extension e.g .exe or maybe all them files *.* how do i do this?I searched on google and found this on MSDN But it doesn't work when i type *. or *.* or *.exe into the textbox and there is files in that folder

VB.NET For Each foundFile As String In My.Computer.FileSystem.GetFiles(Application.StartupPath,Microsoft.VisualBasic.FileIO.SearchOption.SearchTopLevelOnly, TextBox8.Text)My.Computer.FileSystem.CopyFile(foundFile, IO.Path.Combine(FullPath, foundFile))Next

View 3 Replies

Wildcards In Obj.ActiveDocument.Content.Find.Execute

Mar 3, 2009

I find and replace text in a .doc file using MS Access visual basic. Here is my Sub:***************************************************************Public Sub

[Code]...

View 1 Replies

Executing Shell Commands/file Deletion With Wildcards?

Oct 10, 2011

I need to execute the following commands from my application:

Echo Y | DEL C:Folder1cache*.*
DEL C:Folder1file.abc
DEL C:Folder1file.xyz

[code].....

View 14 Replies

VS 2008 - Wildcards - Have X.text Change To A Predetermined Value (hardcoded)

Sep 18, 2009

HTML

If CompLang.Text = "ru***" Then
CompLang2.Text = "working"
End If

This is just a simple example. I'm trying to make it so that if one x.text = ru*** (for instance, ru---, or ruuuu, or rux2x, etc.) to have x.text change to a predetermined value (hardcoded).

View 3 Replies

C# - Search For Names In The Database That Matches Whole Parameters Or Any Part Of Parameters

May 13, 2011

I'm writing a query to select all records that has any part of parameter. I have one table called Employees. Some people have name like this: John David Clark If the parameter is

[Code]....

I should be able to get result back as long as there's a match in the parameters. If I use Function Contains (q.FirstName & " " & q.LastName).Contains(employeeName), I will not get any result back if employeeName is "John Clark" Function Contains looks only for next words from left to right. It doesn't match a single word at a time. So that's why I used this in the Linq to SQL:

[Code]....

View 2 Replies

Error [07002] The # Binded Parameters < The # Of Parameters Makers

Aug 30, 2010

I am getting error [07002] the # binded parameters < the # of parameters makers, i checked both parameters were perfect even though i am getting this error here is my code

[Code]...

View 1 Replies

Regex - Mass Search And Replace With Wildcards Or Reg Expression MyString.Length To Len(MyString)

Oct 14, 2010

I have a large ASP.NET project where I want to do a mass search and replace (about 3500 instances)

I want to change

If strErrorMessage.Length > 0
If strSomeString.Length > 0
If strWhatever.Length > 0

and any other similar call to the Length method from a string to the following

If Len(strErrorMessage) > 0
If Len(strSomeString) > 0
If Len(strWhatever) > 0

Anyway to reliably do this in one shot?

I can do a search and replace for something like If *.Length > 0 --> If Len(*) > 0

This just won't work though as it won't understand how to rearrange it properly. Currently have VS2010 and N++ at my disposal.

View 2 Replies

C# - Difference With Parameters.Add And Parameters.AddWithValue?

Feb 6, 2012

Basically Commands has Parameters and parameters has functions like Add, AddWithValue, and etc. In all tutorials i've seen, i usually noticed that they are using Add instead of AddWithValue.

[Code]...

since it saves my coding time. So which is better to use? Which is safe to use? Does it improves performance?

View 2 Replies

Get The GET Parameters And POST Parameters In Just One Function?

Aug 6, 2011

is there a way to get the GET parameters and POST parameters in just one function or Collection in ASP.NET? Like using $_REQUEST in PHP? I'm using VB.NET.

View 3 Replies

.Net Cannot See JET Queries?

Dec 5, 2010

I have a Access 2003 backend db and I'm using vb 2005 to connect to the db via conntection string. It works ok! I can see all the tables but only some of the queries. Why should some queries be absent? In 1 query I have a user define function which cuts up a string. I've created a new VB project with a new connection but the same result. I've compacted the database with not change.

View 2 Replies

Any Way To Combine Two Queries?

Jun 8, 2011

I am trying to UNION the two queries below without success.
Dim
ds1
As
New
DataSet
Dim
MyConnection1 As
New
OleDb.OleDbConnection(GetPOWERConnectionString())
[Code] .....

View 2 Replies

Asp.net - Search Queries In .net?

Aug 3, 2011

I am trying to perform a search query using drop down boxes with a button named search. I want it to bring up the data that is searched for. I dont know where to start from, i have looked around for some coding and different ways to do it but they seem complicated, this is the bit of ASP that is my weakness, need some assistance and guidance. below is the code for the page;

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="ForSale.aspx.vb" Inherits="Users_ForSale" title="Properties For Sale" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>

[code]......

View 1 Replies

Asp.net - SQL Queries Through .NET And JSON?

Feb 19, 2010

I'm trying to figure out how to do SQL queries towards an SQL 2005 Express server and format the return value to JSON. I got the queries working using this (perhaps very newbie-like) code;

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.UI

[code]....

View 3 Replies

Available WMI Queries For ManagementObject

Aug 6, 2009

Where can I find informations on which WMI queries are in fact available for .NET interface through ManagementObjectSearcher. The command below returns exception for "Win32_LogicalDisk", but works for "Win32_Environment". Every reference in msdn directs to msdn library, which contains all Win32 and COM development classes (that seems not to be available from vb .net code):

[Code]...

View 2 Replies

Multiple Sql Queries?

Nov 5, 2010

I have a form that will have at least 3 seperate sql queries that I want to have submitted with an onclick event.

View 4 Replies

Parametrized Queries With ADO.NET

May 18, 2012

I've been going through a lot of forums and see a lot of mention of ADO.NET and how it's better to use. I guess because it's newer and being maintained with current times?I've done google searches for this, but every time I see different programming languages other than VB.NET implementing param queries with ADO.net, or it brings me to results that have oledb commands again.Is there a good ADO.NET for VB.NET tutorial with parametrized queries?

View 3 Replies

Queries - Loop Through Dgv

Dec 14, 2011

finish my querie, it works for the first 2 rows, I need ti to loop through my dgv:

[Code]...

View 4 Replies

Run .sql Files Queries In .net?

Sep 22, 2010

I want to send the a vb.net application which will run some updates on the database. I have built the sql script files which i would normally run thru query analyser but that is not available thru MSDE.I know i can use OSQL or ISQL to run these scripts but i really want to run them thru a VB.Net application.here is the code i'm using which is generating an error beacuse i'm trying to execute more than one statement?

Dim connectionString As String = ' CONNECTION STRING IS HERE
Dim conn As New SqlClient.SqlConnection(connectionString)
Dim cmd As New SqlClient.SqlCommand

[code]....

View 9 Replies

Update Queries In VB?

Nov 23, 2009

i have a form which once the user has entered their correct Account No they will access the jobs relating to their number. I now need to use and update query so that once I select yes in the Query handled box, after clicking the update button, this row will then be deleted from the table. Here is the code that I have so far:

Public Class Form1
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub

[code]....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved