-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: AMK
Message 1 in Discussion
Hi friends I want to convert
the code of DAO to ADO.net with SQL Server with best practices, please help me
in this I am very new to VB.net. Please consider also multi users
consideration, I am writing an application which I suppose to be use by 30
users at a time. <o:p></o:p>
<o:p> </o:p>
I found lot of ways to do,
hence I am confuse. Please either send me the code and I will learn a lot from
it or point to web site to accomplish this type of conversion, I tried
automatic conversion but DAO does not migrated to ADO.net.<o:p></o:p>
<o:p> </o:p>
Please conbvert this code for
ADO.net for SQL Server 2000 and not for Access, <o:p></o:p>
<o:p> </o:p>
So far I can connect to SQL
Server, open connection.<o:p></o:p>
<o:p> </o:p>
Thanks
<o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
MY
DAO CODE<o:p></o:p>
<o:p> </o:p>
These two variable declare
in module file as global scope<o:p></o:p>
<o:p> </o:p>
Global glGrades, glBands as
integer<o:p></o:p>
Global gdbDatabase as
database � Access Database <o:p></o:p>
========================<o:p></o:p>
<o:p> </o:p>
Dim lRsBands, lRsGrades
as recordet<o:p></o:p>
Dim lsSqlq, lsBandId as
string<o:p></o:p>
Dim liCounter, glGrades,
glBands as integer<o:p></o:p>
<o:p> </o:p>
glBands = 4<o:p></o:p>
glGrades = 5<o:p></o:p>
<o:p> </o:p>
lsSqlq = ""<o:p></o:p>
lsSqlq = "
Select * from Bands "<o:p></o:p>
<o:p></o:p>
Set lRsBands =
gdbDatabase.OpenRecordset(lsSqlq, dbOpenDynaset)<o:p></o:p>
<o:p></o:p>
If lRsBands.RecordCount > 0 Then<o:p></o:p>
<o:p></o:p>
lsBandId =
"A" ' initialize 1st
bandid as A, and then inside the loop get next<o:p></o:p>
<o:p></o:p>
For liCounter = 1 To glBands<o:p></o:p>
<o:p></o:p>
lRsBands.AddNew<o:p></o:p>
<o:p></o:p>
lRsBands!BandId = lsBandId<o:p></o:p>
lRsBands!BandEnglishDescription = "Band For " & liCounter<o:p></o:p>
lRsBands!BandArabicDescription = "Band For " & liCounter<o:p></o:p>
lRsBands!NumberOfGrades = glGrades<o:p></o:p>
<o:p></o:p>
lRsBands.Update<o:p></o:p>
<o:p></o:p>
lsBandId
= GetNextAlphabet(lsBandId) ' send
last added band id to get next alphabet sequence<o:p></o:p>
� GetNextAlphabet I already cnverted this function in VB.net
<o:p></o:p>
Next<o:p></o:p>
<o:p></o:p>
' CREATE GRADES<o:p></o:p>
<o:p></o:p>
lsSqlq = ""<o:p></o:p>
lsSqlq = "
Select * from Grades "<o:p></o:p>
<o:p></o:p>
Set lRsGrades =
gdbDatabase.OpenRecordset(lsSqlq, dbOpenDynaset)<o:p></o:p>
<o:p></o:p>
lsSqlq = ""<o:p></o:p>
lsSqlq = "
Select * from Bands "<o:p></o:p>
<o:p></o:p>
Set lRsBands =
gdbDatabase.OpenRecordset(lsSqlq, dbOpenSnapshot)<o:p></o:p>
<o:p></o:p>
If lRsBands.RecordCount = 0 Then<o:p></o:p>
MsgBox
" No Bands found .. Please create bands before creating grades "<o:p></o:p>
Screen.MousePointer = vbDefault<o:p></o:p>
Exit Sub<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
liContinousCounter =
1<o:p></o:p>
<o:p></o:p>
Do While
Not lRsBands.EOF<o:p></o:p>
<o:p></o:p>
For liCounter = 1 To glGrades<o:p></o:p>
<o:p></o:p>
lRsGrades.AddNew<o:p></o:p>
<o:p></o:p>
lRsGrades!BandId = lRsBands!BandId<o:p></o:p>
lRsGrades!GradeId = liContinousCounter<o:p></o:p>
lRsGrades!GradeDescription = "Grade Number " & liContinousCounter
& " of Band " & lRsBands!BandId<o:p></o:p>
lRsGrades!PointsRangeId = liContinousCounter<o:p></o:p>
<o:p></o:p>
lRsGrades.Update<o:p></o:p>
<o:p></o:p>
liContinousCounter = liContinousCounter + 1<o:p></o:p>
<o:p></o:p>
Next<o:p></o:p>
<o:p></o:p>
lRsBands.MoveNext<o:p></o:p>
<o:p></o:p>
<st1:place w:st="on">Loop</st1:place><o:p></o:p>
<o:p> </o:p>
Thanks <o:p></o:p>
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]