Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: mut jayan
  Where is mut jayan?
 chennai
 India
 mut jayan
 Tags
Subject: RE: Acess from vfp
Thread ID: 232910 Message ID: 232972 # Views: 36 # Ratings: 1
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Sunday, June 28, 2009 3:59:25 PM         
   


> I have student databse in MS access namely "student.mdb" the table name is "stu"(D:\muthu\student.mdb) with three fields namely 1.regno 2. name 3. category.
>
> In vfp I have designed "Student.scx" in that i put one text box namely txtsearch and one two command button namely 1. cmdsearch 2.cmdexit.
>
> I have enterd letter of students name in txtsearch box and click cmdsearch button and result will be in browse window.
>
> let assume I have enterd "A" in txtsearch box and click command button whose student names begain with "A" will dispaly in browse window. or if I have enterd "B" in txtsearch box and click command button whose student names begain with "B" will dispaly in browse window.
>
> How to write code?


CREATE DATABASE School 
CREATE CONNECTION Xx CONNSTRING [ get an Ms Office Access ODBC connectionstring from www.connectionstrings.com]
CREATE VIEW vStudents REMOTE CONNECTION Xx AS SELECT * FROM Students WHERE UPPER(name) LIKE ?lcSearchString 

You can also do all of that clicking the buttons in your Project Manager's Data page

Open the form's DataEnvironment and add this view. An image of the columns of the view will appear in the DataEnvironment. Drag this image to the form and a Grid will be added in the form.
In the DataEnvironment window right-click the view and choose Properties.
Mark NoDataOnLoad True.
In the Grid's Init event add this code
lcSearchString ='A%' 
REQUERY('vStudents') 

In cmdSearch.Click add this.code
 lcSearchString=ALLTRIM(UPPER(Thisform.txtSearch.Value) )+'%'
 REQUERY('vStudents') 


Bravo. You created a working parameterized remote view. See VFP's Help for these keywords.
-Anders



COMPLETE THREAD
Acess from vfp Posted by mut jayan @ 6/27/2009 8:26:52 AM
RE: Acess from vfp Posted by Borislav Borissov @ 6/27/2009 8:31:11 AM
RE: Acess from vfp Posted by Anders Altberg @ 6/28/2009 3:59:25 PM