how to use connection?

joshtheflame

Member
Joined
Dec 21, 2008
Messages
7
Programming Experience
3-5
Hi There,
I have been programming in Oracle using PL/SQL since last 5 years and now I have got the oppertunity to develop a system in VB.net using SQLSERVER 2005...Front End is not a problem for me...I want to know the best practices to use SQLSERVER 2005 with VB.net and how to use connection string ...should I pick it up from a file or hardcode inside....Professional guidance will be helpful for me or any reference url's

Thanks
 
Matt thanks alot for the reply. Need to ask things after review of the links u sent.

1. Professionally which way you suggest or what are the professional practices to create database connection..either through coding like DIM ConnObj as new SqlConnection etc etc or using the View->Data Sources and all?

2. On Each form do I need to create this connection and use or just once using LOGON form and use the other methods to insert, update, retrieve, delete data...a lil confuse I am cause oracle is quite different then this VB. Please help or a sample code will be a great help.

Thanks
 
its not a good idea of creating connection on every form.. bcoz sometime u have to chg the conn , and u have to go forms and forms to chg it.. please create a global connection with public ... and its good and professional way to work with connections..


and i prefer you to not to open data using dim command everytime or when it is not needed bcoz it will consume ur more time ...just do it where u need to program them , like as u need to create a order system or some query....plz do those with command using dim . .Net developed for reduce ur coding and if u are using dim command of opening data from db , the same thing will do the others so there is no difference between you and others when open table eveytime using dim command .. .. its my idea.. maybe there are other people who different thoughts .
 
Alim,
Can i get some samples or a sample project (not a real one offcourse) I would really appreciate as I have only 15 days left to complete the application.

Thanks
 
Last edited by a moderator:
so which examples you want.. i hope you have learned how to open database with using drop-drag from your datasouce now you need to learn how to query and open data from database...am i right?

if i m not.. plz tell me which samples you need!

I m in a position like , and i have spend my 3 months to learn how to work with it.. bcoz when i m new in Vb.net , i dn't knw this forums address and no video helps are available bt now you can get both of them
 
Alim...I have made sql connection so far i have learned that...just need the right approach in shape of a project with 2 to 3 forms including a login form...to get the idea how it works...some people make classes for each form and put all the procedures and connections in it and some do the other way..whatever way you do it let me know.

If you dont have a sample project made in visual studio you can provide me some of your forms/classes to get the idea how you work. I am just a learner and want to do good programming in VB.net if you help me it would be great

Thanks
 
my developed classes are so professional i spend my 2 yrs to develop them , so it is really tough for you to learn from there , becoz all codes are in complex format.. although i m the developer of those classes ,sometime i forgot some of functionality ...

i want to develop some samples for u when u asked me bt.. now you can provide your samples , i understood what you want to do. i will help you and give you the edited version..

i will give you the solution.
You can upload ur files in msn skydrive or in mediafire.com..
n give me the link
 
this is my softs login interface image

a0iiwo.jpg
 
Dear Alim,
Thank you for your offer...I need only two forms+classes. I need the following sample forms.

1. LOGON form (username, password)
2. umm lets say a Customer Form (CustomerID, CustomerName, CustomerAddress, CustomerEmail)

thats it ...and i need ADD, EDIT, DELETE, FIND buttons on it...Just to get an idea how you manage these two forms and what approach you have using your classes.

I've added you on msn btw.
 
add my yahoo id, aukchat

you can add data in database in many ways

on simple way:
VB.NET:
Dim R as datarow
R= dataaset.Datatable.newrow
r.item("ColumnName"/Integer)=Value
r.item("ColumnName"/Integer)=Value
r.item("ColumnName"/Integer)=Value
r.item("ColumnName"/Integer)=Value
dataset.Datatable.Rows.Add(R)
'if there is no error on data entry ur data will now exist in dataset, datatable
'now you have send it to database..
' you can just execute the automatic genarated dataadapter to send records to 'database
AutomaticCreatedDataAdapter.update(Dataset.DataTable)
'if there is no dublicate rows or any problems exists ur data will send to db ... no 'questions ask
'you can also use Try command to catch those exceptions



------------
i have solved the whole thing and u can download my developed source from below link:
Source
 
Last edited:
Alim thank you so much for solving my issue...your code really helped me to understand the basics of database programming in VB.NET ..Good and simple logic with style I must say.

Thank you so much buddy :)
 
Back
Top