PDA

نسخه کامل مشاهده نسخه کامل : ستجو Sql در ویژوال بیسیک



vorojax
23-11-2006, 07:34
سلام من کد جستجوی کلی را در وی بی می خوام
جستجوی sql

kbdfa
23-11-2006, 09:14
جستجو به چه منظور؟
در كل ميتوني از دستورات SQL نظير SELECT با يه شرط استفاده كني تا مثلا حذف كني يا به يه جدول ديگه ببري
اگه msdn داشته باشي مثالهاي خوبي داره ميتوني ازاون استفاده كني اگه نتونستي بگو برات يه نمونه بذارم

vorojax
23-11-2006, 23:10
msdn ندارم اگه ميشه يه مثال سادشو خودت برام بزار

kbdfa
24-11-2006, 10:06
چشم دوست عزيز رفتم خونه در اولين فرصت برات يه نمونه ميذارم

vorojax
24-11-2006, 10:58
رفيق دمت گرم.

kbdfa
24-11-2006, 17:55
اين يه مثال از خود ام اس دي ان هست
Dim dbs As Database, rst As Recordset

' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase("Northwind.mdb")

' Select the last name and first name values of all
' records in the Employees table.
Set rst = dbs.OpenRecordset("SELECT LastName, " _
& "FirstName FROM Employees;")

' Populate the recordset.
rst.MoveLast

' Call EnumFields to print the contents of the
' Recordset.
EnumFields rst,12

dbs.Close
اينم شكل كلي دستور
SELECT [predicate] { * | table.* | [table.]field1 [AS alias1] [, [table.]field2 [AS alias2] [, ...]]}
FROM tableexpression [, ...] [IN externaldatabase]
[WHERE... ]
[GROUP BY... ]
[HAVING... ]
[ORDER BY... ]
[WITH OWNERACCESS OPTION]

The SELECT statement has these parts:

Part Description
predicate One of the following predicates: ALL, DISTINCT, DISTINCTROW, or TOP. You use the predicate to restrict the number of records returned. If none is specified, the default is ALL.
* Specifies that all fields from the specified table or tables are selected.
table The name of the table containing the fields from which records are selected.
field1, field2 The names of the fields containing the data you want to retrieve. If you include more than one field, they are retrieved in the order listed.
alias1, alias2 The names to use as column headers instead of the original column names in table.
tableexpression The name of the table or tables containing the data you want to retrieve.
externaldatabase The name of the database containing the tables in tableexpression if they are not in the current database.
اگه كامل نبود و متوجه نشدي بگو بعدا يه برنامه كوچك برات بدم تا خوب متوجه شي

vorojax
27-11-2006, 17:09
دوست عزيز تشكر