473,548 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

probleum in select statement

198 New Member
Hi
this is a silly question but it is wasting of lot of my time actually i want to search a string in mdb file using select statement
the string is

CmpnyName ="killeen women's health center"
and select statement is
Expand|Select|Wrap|Line Numbers
  1.  sOldQuery = "select CMPNYNM from " & txtOldTableName.Text & " where CMPNYNM = '" & NewCmpnyName & "'"
it produces the error due to " ' " sign in women's word and when i use
Expand|Select|Wrap|Line Numbers
  1.  
  2. sOldQuery = "select CMPNYNM from " & txtOldTableName.Text & " where CMPNYNM = '" & Replace(NewCmpnyName, "'", "") & "'"
  3.  
it works fine what could not find any string from mdb table because the CMPNYNM in mdb table is like "killeen women's health center"


how is it possible so that this kind of strings are searched using select query
please reply as soon as possible
thanks in advance
varinder
Jun 23 '08 #1
3 1082
senol
6 New Member
good
Expand|Select|Wrap|Line Numbers
  1.  
  2. <asp:DropDownList ID="drpListIl" runat="server" Width="268px" DataTextField="il" DataValueField="il" AutoPostBack="True" OnSelectedIndexChanged="drpListIl_SelectedIndexChanged"> </asp:DropDownList>
  3.  
  4. protected void drpListIl_SelectedIndexChanged(object sender, EventArgs e)
  5. {
  6. drpListIlce.DataSource = baglantitable.DV_Sonuc("SELECT * from tbl_ilceler where yol='" + drpListIl.SelectedValue + "' ");
  7. //grupuc.DataTextField = "kategori_isim";
  8. //grupuc.DataValueField = "kategori_id";
  9. drpListIlce.DataBind();
  10. }
  11.  
ok??
Jun 23 '08 #2
DrBunchman
979 Recognized Expert Contributor
Hi varinder,

Instead of replacing the single quotes with a blank use two single quotes as these will be interpreted by your database engine as a single quote. Like so:
Expand|Select|Wrap|Line Numbers
  1.  
  2. sOldQuery = "select CMPNYNM from " & txtOldTableName.Text & " where CMPNYNM = '" & Replace(NewCmpnyName, "'", "''") & "'"
  3.  
Hope this helps,

Dr B
Jun 23 '08 #3
veer
198 New Member
thanks very much
it works fine
i need another answer
i am using vs.net 2008 when i made a program and then want to make setup of that program and when i finish the setup the program shortcut icon does't show in start->Program
i have to do it manully can you tell me why it is behaving like this


Hi varinder,

Instead of replacing the single quotes with a blank use two single quotes as these will be interpreted by your database engine as a single quote. Like so:
Expand|Select|Wrap|Line Numbers
  1.  
  2. sOldQuery = "select CMPNYNM from " & txtOldTableName.Text & " where CMPNYNM = '" & Replace(NewCmpnyName, "'", "''") & "'"
  3.  
Hope this helps,

Dr B
Jun 24 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
1331
by: veer | last post by:
hello expert i am trying to apply a query on mdb table 123, I want to show the record of a operators lies between particular date , the querey is SELECT Yp1EOp, Count(*) AS FROM 123 WHERE Yp1EOp<> " " AND yp1estarttime > ' 12/11/2007 10:10:10 PM ' AND yp1eendtime < ' 15/11/2007 06:50:00 AM ' GROUP BY Yp1EOp; it shows the error datatype...
2
1326
by: veer | last post by:
hello expert i made a website which opens in ie6 and works fine but when i open it in ie7 it creates probleum the probleum is that i have a footer in my webpage , it automatically moves in the middle of webpage but when i open the same webpage in ie6 it opens fine please provide help
2
1061
by: progvar | last post by:
Hi! i have a query and i want to print the value of this query by programing. I use this query in ms-access and works fine but when i execute this query in visual basic it does't produce any error but no value is printed. Please provide the help Set dbMn = Workspaces(0).OpenDatabase(txtpath) Set RSmn = dbMn.OpenRecordset("SELECT UDAC,...
0
872
by: veer | last post by:
Hi i installed sql server7.0 on my window XP operating system and now i want to create a server group and then register it but it alwys displays the error "SQL server doest exist or access denied connection open" for creatng server group i used to right click on servers and then click on new sql server group a new window open i gave...
3
1486
by: veer | last post by:
Hi i run this query it works fine Select Yp1VOp,count(*) as instrec into instrec from " & txttablename & " where Yp1EOp=Yp1VOp Group By Yp1EOp,Yp1Vop Order By Yp1EOp,Yp1VOp but when i put a column name Yp1EOp = " " it produce the error the qeury like this Select Yp1VOp,count(*) as instrec into instrec from " & txttablename & " where...
4
1467
by: veer | last post by:
hi i have programe in which works fine for seaching the data from a file but when the i want to seach the word like" mögen ". In this word " ö " has some other kind of shap and my programe did not searh it please tell me how i will remove this probleum varinder
2
1264
by: veer | last post by:
Hi i made a programe in which i want to calculate the total time from a column but when i declare a variable having datatype is "date" then the default value in this variable is "12:00:00: and when the calculation is less than 1 hour just like 38 minutes 56 sec it creates the probleum and shows like 12:38:56 i searched on net but im not...
3
1447
by: veer | last post by:
Hi i have some probleum in reading the data from .val extension file when i manually open the file in notepad and just click on file option -> save -> close the txt file and then read the data from vb.net coding it works fine but when i read the data from the selected file directly from coding it reads only first two characters what is this...
1
1555
by: veer | last post by:
hi i think it's a silly question but i am very confused about this actually i made program on spell check.This is done by creating object of msword and then with the help of this object i create a temperary document and then apply spellchecking . But when i run this program it execute very slow like if i have a dbf file of 100 records it takes...
0
7512
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7438
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7951
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7803
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5082
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3495
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1926
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
751
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.