473,378 Members | 1,382 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Problem with Datagrid

Hi,

My Query is "SELECT * FROM table WHERE Acc_no like '1*' "

If I run this query in Ms-Access directly, it is working fine.

but if i try to show the same result in the datagrid, it is not showing any results.

My code is :
strsql = "SELECT * FROM table WHERE Acc_no like '1*' "
Set rs = Login.conn.Execute(strsql)
Adodc1.RecordSource = strsql
Adodc1.Refresh

If I give the same like below, It is working fine.
strsql = "SELECT * FROM table WHERE Acc_no = '1' "
Set rs = Login.conn.Execute(strsql)
Adodc1.RecordSource = strsql
Adodc1.Refresh


Could you help me out in this?
Thanks in advance.

Regards,

Venkat.
Jan 29 '08 #1
2 992
jamesd0142
469 256MB
Hi,

My Query is "SELECT * FROM table WHERE Acc_no like '1*' "

If I run this query in Ms-Access directly, it is working fine.

but if i try to show the same result in the datagrid, it is not showing any results.

My code is :
strsql = "SELECT * FROM table WHERE Acc_no like '1*' "
Set rs = Login.conn.Execute(strsql)
Adodc1.RecordSource = strsql
Adodc1.Refresh

If I give the same like below, It is working fine.
strsql = "SELECT * FROM table WHERE Acc_no = '1' "
Set rs = Login.conn.Execute(strsql)
Adodc1.RecordSource = strsql
Adodc1.Refresh


Could you help me out in this?
Thanks in advance.

Regards,

Venkat.
you have to play around with query's in vb try using:


Expand|Select|Wrap|Line Numbers
  1. strsql = "SELECT * FROM table WHERE Acc_no like " & "'" & "1%" & "'"
  2.  
its the ' thats throwing it out u see
Jan 29 '08 #2
lotus18
866 512MB
It is unnecessary to enclosed ' if the acc_no is a number type (access),

Rey Sean
Jan 29 '08 #3

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

Similar topics

2
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell...
0
by: Emerson | last post by:
The following assumes a System.Windows.Forms.DataGrid with a System.Data.DataTable set as the DataSource. I'm programming in C# Here's my scenario I click in a cell on a DataGrid. I enter some...
1
by: Joe Bloggs | last post by:
I am trying display the contents of a table in a web page, select certain rows from that table and then display the fields that I have selected (now table columns) as text in a Label object....
5
by: Jeff | last post by:
IDE: VS 2003 :NET OS: XP Pro My app have a form with a tab-control on it. The tab-control have 2 tabpages. One of the tabpages displays a datagrid, and the other tabpage displays details (order...
3
by: vinayak | last post by:
Hi I am displaying data in Datagrid in ASP.NET with Edit/Update functionality for each row. On the same page I have 2 Button controls which submits the request to server. These button controls...
4
by: The Alchemist | last post by:
I am having a problem with a dynamically-generated Datagrid. It is important to point out that this problem does not exist with a design-time created Datagrid, but only with a dynamically generated...
7
by: Neo Geshel | last post by:
Greetings. I have a serious problem. I have multiple sets of tables, several of which are chained more than two tables deep. That is, I have a parent, a child, and a great-grandchild table. ...
7
by: Girish | last post by:
OK.. phew. Playing with data grids for the past few days has been fun and a huge learning experience.. My problem. I have a requirement to display a gird with a gird. Within the embedded grid,...
9
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the...
2
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.