-
سوال در مورد ویژوال بیسیک و adodc
سلام دوستان
پروژه بانک اطلاعاتی مدرسه نوشته ام می خواهم عده ای از بچه ها که بدهکار هستند را جستجو کنم اگر با فایند بنویسم اولین رکورد که پیدا کرد بقیه پیدا نمی کند اگر با فیلتر بنویسم باید شرط را سورسش بنویسم ودیگر نمی توانم شرط را عوض کنم با توجه با اینکه اصلا از اس کیو ال استفاده نکرده ام وارتباط از طریق ا دی ا است چونه امکان پذیر است
مطلب دوم من بانکی برای دفتر اندیکاتور زده ام این موسسه شامل چند مدرسه است ایا برای هر مدرسه بانک جدا بزنم
به کمک adodc با بانک ارتباط برقرار کردم
با fiind فقط مورد اول پیدا می کند برای بقیه موارد که مطابق با شرط باشد چگونه عمل می کنیم
خواهش می کنم سریع تر!:عصبانی++:
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
خيلي ساده - يك Adodc تروتازه بزارين رو فرم و هيچ خصوصيتيشو تغيير نديد.
تو قسمت لود فرم بنويسيد:
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\DB.mdb"
Adodc1.RecordSource = "SELECT * FROM Table1"
Adodc1.Refresh
و حالا براي جستجو بايد دستورات SQL رو تو RecordSource قرار بديد و اينو فراموش نكنيد كه حتماً بعدش بايد Adodc رو رفرش كنيد تا تغييرات اعمال بشه. مثل بالا.
مثلاً فرض كنيد مي خوايم توي Table1 تو فيلد Name هرچي اسم كه "علي" هست رو بياره. (فقط "علي"):
Adodc1.RecordSource = "SELECT * FROM Table1 WHERE Name='علي'"
Adodc1.Refresh
حالا براي اين كه اگه سرچ كرديم "علي" برامون هم "علي" رو بياره و هم "عليرضا" و يا هرچيز ديگه اي كه توش "علي" داره.
براي اين كار از عملگر Like استفاده مي كنيم و كنار هر تك كوتيشن علامت % ميزاريم:
Adodc1.RecordSource = "SELECT * FROM Table1 WHERE Name Like '%علي%'"
Adodc1.Refresh
دقت كنيد كه علامت % در هرطرف رشته به معني اين هست كه اون سمت رشته هر چيز ديگه اي هم بود فيلترشه. يعني اگر % قبل "علي" رو برداريم ديگه "محمدعلي" تو نتايج ظاهر نميشه.
نكته: براي رشته ها حتماً بايد از تك كوتيشن استفاده كنيد و براي اعداد نيازي به ' يا " نيست و فقط خود عدد رو مي نويسيم.
موفق باشيد/
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
خيلي ساده - يك Adodc تروتازه بزارين رو فرم و هيچ خصوصيتيشو تغيير نديد.
تو قسمت لود فرم بنويسيد:
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\DB.mdb"
Adodc1.RecordSource = "SELECT * FROM Table1"
Adodc1.Refresh
------------------------------------------------------
دوست عزیز این قسمت که شما گفتید در مورد بانک اطلاعاتی SQL Servrer درست عمل نمیکنه و با اخطار ست نبودن خصوصیات ADODC روبرو میشه
اگه ممکنه یه توضیح در این مورد هم ارایه کنید
با تشکر
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
نقل قول:
اگه ممکنه یه توضیح در این مورد هم ارایه کنید
با تشکر
پيشنهاد مي كنم در مواقع پاسخ به پست ها يه نگاهي هم به تاريخ ايجاد پست بنماييد
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
نقل قول:
دوست عزیز این قسمت که شما گفتید در مورد بانک اطلاعاتی SQL Servrer درست عمل نمیکنه و با اخطار ست نبودن خصوصیات ADODC روبرو میشه
اگه ممکنه یه توضیح در این مورد هم ارایه کنید
با تشکر
ConnectionString برای دیتابيس SQL فرق ميكنه. نحوه ارتباط با ديتابيس SQL رو جستجو کنید.
می تونید از این سایت هم استفاده کنید: http://connectionstrings.com
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
با سلام و خسته نباشید به شما
بنده هنگامی که می خواهم در ویژوال بیسیک متصل به بانک اطلاعاتی اکسس جستجو را بر اساس کد ملی انجام بدم متاسفانه با خطای method 'refresh' of object 'IAdodc' failed مواجه می شوم که محل خطا به صورت قرمز رنگ می باشد .در ضمن کد برنامه به صورت زیر است. نکته جالب توجه این است که این سرچ را برحسب نام یا نام خانوادگی انجام دادم هیچ مشکلی ندارد. و در قسمت مرتب کردن نیز که با دستورات اس کیو ال نوشتم همین مشکلات رخ داد و جالب اینجاست که میخواستم مرتب کردن را برحسب یکی از فیلدهای متنی غیر از نام یا نام خانوادگی انجام دهم با خطای بالا روبرو شدم. لطفا اگر ممکنه در این زمینه راهنمایی لازم را فرمایید. با تشکر
Dim skin As String
Private Sub cmdall_Click()
Adodc1.RecordSource = "SELECT * FROM Table1"
Adodc1.Refresh
Call Form_Activate
End Sub
Private Sub cmdgo_Click()
Call cmdall_Click
Adodc1.RecordSource = "select * from table1 where fn like '" & txtbyname.Text & "%'"
Adodc1.Refresh
On Error GoTo X
If Adodc1.Recordset.Fields(0) = "" Then
Call cmdall_Click
MsgBox3 Me, "јæÑÏ ãæÑÏ äÙÑ íÇÝÊ äÔÏ.", vbOKOnly, "ÌÓÊÌæ äÇãæÝÞ"
End If
Exit Sub
X:
MsgBox3 Me, "äÇã ãæÑÏ äÙÑ íÇÝÊ äÔÏ.", vbOKOnly, "ÌÓÊÌæ äÇãæÝÞ"
Call cmdall_Click
txtbyname.Text = ""
End Sub
Private Sub cmdgocom_Click()
Call cmdall_Click
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "SELECT * FROM table1 WHERE co-m = '" & Trim(txtbycom.Text) & "'"
Adodc1.Refresh
On Error GoTo X
If Adodc1.Recordset.Fields(0) = "" Then
Call cmdall_Click
MsgBox3 Me, "јæÑÏ ãæÑÏ äÙÑ íÇÝÊ äÔÏ.", vbOKOnly, "ÌÓÊÌæ äÇãæÝÞ"
End If
Exit Sub
X:
MsgBox3 Me, "äÇã ãæÑÏ äÙÑ íÇÝÊ äÔÏ.", vbOKOnly, "ÌÓÊÌæ äÇãæÝÞ"
Call cmdall_Click
txtbycom.Text = ""
End Sub
Private Sub cmdgofn_Click()
Call cmdall_Click
Adodc1.RecordSource = "select * from table1 where ln like '" & txtbyfname.Text & "%'"
Adodc1.Refresh
On Error GoTo X
If Adodc1.Recordset.Fields(0) = "" Then
Call cmdall_Click
MsgBox3 Me, "јæÑÏ ãæÑÏ äÙÑ íÇÝÊ äÔÏ.", vbOKOnly, "ÌÓÊÌæ äÇãæÝÞ"
End If
Exit Sub
X:
MsgBox3 Me, "äÇã ÎÇäæÇÏí ãæÑÏ äÙÑ íÇÝÊ äÔÏ.", vbOKOnly, "ÌÓÊÌæ äÇãæÝÞ"
Call cmdall_Click
txtbyfname.Text = ""
End Sub
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
اگر فیلد co-m از نوع عددی هست، نیازی به علامت های ' در دوطرف رشته نیست:
Adodc1.RecordSource = "SELECT * FROM table1 WHERE co-m =" & Trim(txtbycom.Text)
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
نقل قول:
نوشته شده توسط
xxxxx_xxxxx
اگر فیلد
co-m از نوع عددی هست، نیازی به علامت های
' در دوطرف رشته نیست:
Adodc1.RecordSource = "SELECT * FROM table1 WHERE co-m =" & Trim(txtbycom.Text)
ضمن تشکر از پاسختون مشکل برطرف شد به این صورت که در بانک اطلاعاتی اکسس کدملی که به عنوان کلید اصلی و از نوع عددی انتخاب شده است آن را تبدیل به رشته کردم و با این تغییرات در اکسس و ADO نیز مشکل برطرف نشد ولی وقتی به فیلد نام و نام خانوادگی توجه کردم دیدم که علامت منها بین کلمات نبود لذا با تبدیل co-m به com مشکل برطرف شد و دیگه اخطار نداد در ضمن آیا نوع آن را می توان به نوع عددی تغییر داد که مشکلی نداشته باشد. حالا با مشکل دیگه ی روبرو هستم و آن این که وقتی می خواهم اسمی رو جستجو کنم چه به صورت دقیق و چه به صورت مشابه در برخی از کلمات مشکل دارد. مثلا من فامیلی توانا را سرچ کردم به راحتی پیدا شد. اما فامیلی احمدی در قسمت جستجو بدون نتایج مشابه هیچی را پیدا نکرد اما در قسمت نتایج مشابه( منظور استفاده از like) وقتی احمد یا حرفهای قبل از آن را جستجو می کند نتایج را پیدا می کند اما وقتی احمدی را جستجو می کنم هیچی پیدا نمی کند . ظاهر با حرف ی مشکل دارد. و درخواست دیگر با کمال شرمندگی چطور می توانم قبل از ذخیره کردن اطلاعات بدانم که قبلا کد ملی در بانک اطلاعاتی ثبت نشده است یعنی پیغام بدهد که کد ملی مورد نظر ثبت شده است تا از داده های تکراری جلوگیری شود. در این زمینه اگر لطف کنید راهنمایی کنید ممنون میشم.
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
می خواستم بدونم چرا تو منوی project ویژوال بیسیکی که نصب کردم Data Environment وجود ندارد
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
نقل قول:
نوشته شده توسط
dgsaieed2010
می خواستم بدونم چرا تو منوی project ویژوال بیسیکی که نصب کردم Data Environment وجود ندارد
سلام عليکم
به برنامه نويس . org خوش اومديد
تاپيکتون رو جاي مناسبي ايجاد نکرديد.
به نظرم ويژوال بيسيک شما ناقصه!يعني ويژوال استاديو فول نيست.
موفق باشيد
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
سلام دوستان عزیز من دارم با نرم افزار ویژوال استدیو 2010 قسمت ویژوال بیسیک یک نرم افزار برای مدیریت کتابخانه عمومی طرحی میکنم برای طراحی جدول به مشکل برخوردم نمیدونم چیکار کنم یعنی از ابزار مربوط به جدول استفاده کردم اما برای دادن مقدار به جدول و فیلدهای اون نمیدونم باید چیکار کنم ... فکر کنم مربوط به بانک اطلاعاتی بشه اگر ممکنه راهنمایی کنید که چیکار باید کنم خیلی فوری نیاز دارم
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
سلام به همه کاربران و مدیران برنامه نویس.
من میخواستم یه سری اطلاعات رو در اکسس با استفاده از ADO و DataGrid سورت کنم
لطفا کمکم کنید، من واقعا سراین موضوع خیلی وقته که مشکل دارم.
با تشکر!!!
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
شما باید به وسیله ی ویژوال یک بانک درست کنی بعد یک adodc و datagride روی فرمت بزاری بعد روی adodc کلیک راست کنی و گزینه ی adodc properties کلیک کن در صفحه ی باز شده روی گزینه ی سوم کلیک و بعد build را بزن بعد ادرس دقیق بانکتو بده test connection رو بزن تا از اتصال بانک اطمینان پیدا کنی بعد ok کن و در تب record source گزینه ی command type را رو 2 قرار داده بعد از کادر پایینیش اسم table ان را انتخاب کنید و بعد ok کنید حال روی datagride کلیک کرده و از قسمت prpperties ان datasource آن را برابر adodc1 قرار بده
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
سلام من یک مشکل دارم می خوام یک برنامه بنویسم که مدیر سیستم بتونه کاربر تعریف کنه که پسورد داشته باشه و هر کاربر با پسورد و نام خودش وارد برنامه بشه
اگه زود تر جواب بدین ممنون می شم اگه میشه به وسیله ی بانک باشه و اصطلاحات عام باشد مثلا به جای password نگویید pass ممنون
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
سلام
تو دیتابیس باید یه جدول درست کنی، بعد هر وقت خواستی کاربری رو تعریف کنی اطلاعاتش رو(نام، پسورد و ...) رو به این جدول اضافه میکنی.
موقع داخل شدن کاربر هم نام و پسوردش رو میگیری بعد تو اون جدول سرچ میکنی اگه موجود بود و اطلاعات مطابقت داشت میگی: خوش اومدی!
فقط یادت نره پسورد رو کدگذاری کنی.
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
لطفا اگه میشه کد برنامه رو بگزارید که باید چطور سرچ کرد و اگه بود وارد بشه و اگه نبود وارد نشه چون من این کارو کردم ولی بازم اگه کاربر پسورد وارد نکنه میتونه بازدن کلید ورود وارد شود.
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
نقل قول:
نوشته شده توسط
mahdi bashibdar
لطفا اگه میشه کد برنامه رو بگزارید که باید چطور سرچ کرد و اگه بود وارد بشه و اگه نبود وارد نشه چون من این کارو کردم ولی بازم اگه کاربر پسورد وارد نکنه میتونه بازدن کلید ورود وارد شود.
سلام،
با متد Find میتونید این کار را انجام بدید ، اما به نظر من خوب نیست ....
من خودم همیشه با RecordSource این کار را انجام میدم و به شما هم همین روش را پیشنهاد میکنم.
نمونه کد :
Dim sSQl As String
sSQl = "SELECT * FROM tableName WHERE fieldName= '" & txtSearch.Text & "' "
adodcSearch.CommandType = adCmdText
adodcSearch.RecordSource = sSQl
adodcSearch.Refresh
موفق باشید ../.
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
سلام من می خوام با رفتن از فرمی به فرم دیگر بانکم توسط adodc به روز بشه لطفا کمک کنید و کد اون رو قرار بدین
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
سلام خدمت دوستان خوبم
من یه بانک اکسس دارم میخوام از طریق فیلد نام و نام خانوادگی و یه فیلد دیگه که از combo انتخاب میشه سرچ رو انجام بده ولی نتونستم انجام بدم . یعنی اگه (ع) در نام و (ر) در فامیلی و گزینه انتخاب شده از combo رو تایپ کردیم تمام اسم هایی که با (ع ) و فامیلی که (ر) و فیلد combo رو شامل میشن تو datagrid نمایش بده ممنون میشم کمک کنید
الان از طریق این کد بر اساس گزینه انتخاب شده تو combo سرچ رو انجام میدم
" '%" & Adode1.RecordSource = "select * from Kol_Asli where Code_shobe like '%" & Combo1.Text
Adode1.Refresh
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
سلام بنده دارم یه برنامه با ویژوال بیسیک می نویسم میخواستم چندتا سوال از شما بزرگواران سوال کنم
1.چطور میشه در سطری که در datagrid انتخاب شده در فرم دیگه اطلاعات همون سطر را بشه ویرایش یا حذف کرد؟؟
2.چطور میشه دوتا چیز را همزمان با هم با کد filtter پیدا کرد؟(یه دونه راحته ولی وقتی دوتا میشه درست نمیشه)
3.چگونه میشه از datareport استفاده کرد؟؟
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
در مورد سوال اول.
وقتی می خوای اطلاعت یه سطر رو ویرایش کنی ابتدا تمام اون فیلد های جدول رو بریز توی Text بعد که اطلاعات رو ریختی می تونی یه Adoct جدید بذاری روی همون فرم و اطلاعات رو اپدیت کنی بعد توی فرم اصلی قسمت Active یه دستور رفرش بنویسی..
سوال دوم از دستور Adode1.RecordSource و And بین دو جستجو استفاده کنید .
در مورد سوال سوم هم برو سراغ فست ریپورت یا اکتیو ریپورت که توصیه میکنم فست ریپورت رو استفاده کنی .
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
سلام
ببخشید وقتی من datareport رو میارم بالا، گزینه data environment واسم نمیاد بالا تا به دیتابیسم وصلش کنم
چه جوری میشه اوردش بالا.هرکاری کردن نشد.اصلا میشه با کد به دیتابیس وصلش کرد؟؟ کد رو واسم بنویسید.
باتشکر
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
بله در مورد اتصال هم از طریق کد نویسی میشه و هم از طریق دستی
شما واسه اضافه کردن بانک به
ابتدا یک DataEnvironment ایجاد کنید .
از صفحه باز شده یک کانکشن هست بنام Connection1 روی اون کلیک راست کنید و گزینه Propertise رو بزیند از سر برگ انتخاب شده در قسمت Connection مسیر بانک اطلاعتی رو بدهش بدید ..
تا اینجا تموم شد .
حالا روی همون کانکشن 1 که باک بهش وصل کردی کلیک راست کن و گزینه Add Command رو بزن و روش کلیک راست کن و گزینهPropertise و از قسمت Database Object رو Table بذار و قسمت پایین تر هم نام جدولت رو بذار .
تموم شد و می تونی طراحی کنی.
و بعد از طریق کد نویس وصل کن به هم .DataReport.DataSource = ado
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
ه رچند توصیه می کنم برای سراغ یه گزارش ساز دیگه این خیلی ناقصه تنظیم صفحه بصورت Por یا Lan نداره و محیط خیلی خوبی واسه طراحی نداره
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
مثلا چی؟؟ میشه اسم بیارید و نحوه کار با اون هم توضیح بدید
-
نقل قول: سوال در مورد ویژوال بیسیک و adodc
فست ریپورت یا اکتیو ریپورت و یا کرستال ریپورت.
که Fast Report رو پیشنهاد می کنم.
لینک دانلود. فست ریپورت
http://rasekhoon.net/software/show/5...lphi-v4-9-195/