Author Topic: VB.NET Program with SQL SERVER ?  (Read 135 times)

0 Members and 1 Guest are viewing this topic.

Offline nomadic

  • Full Member
  • *
  • Posts: 105
  • Karma: +0/-0
    • View Profile
VB.NET Program with SQL SERVER ?
« on: March 30, 2010, 04:01:58 PM »
Mga boss

baka po pwede patinigin ng sample programs

yung simpleng pag connect sa sql server express
pag insert ng data sa db at pag retrieve parang phonebook

gagawa kasi ako mini-banking system..hehe

marunong nmn ako basic
marunong din naman MSSQL

kaso yung pagconnect wala ako makitang madali intindihing tutorial

need ko lng tlga..naging busy kasi ako masyado sa pagaaral ng
php+mysql kaya naubusan ako ng Oras para sa

Techronnati | where technology never sleeps

VB.NET Program with SQL SERVER ?
« on: March 30, 2010, 04:01:58 PM »

Mountain View

Offline Transformer10

  • Full Member
  • *
  • Posts: 104
  • Karma: +0/-0
    • View Profile
Re: VB.NET Program with SQL SERVER ?
« Reply #1 on: March 30, 2010, 04:03:07 PM »
To retrieve records from MSSQL database, you need to put it in a Dataset:

Public Function MyDataset()

Dim conn as new SqlConnection
Dim adapter as SqlDataAdapter
Dim connstr as String = (your connection string)

MyDataset = New Dataset
conn.ConnectionString = connstr
adapter = new SqlDataAdapter((your query), conn)

adapter.Fill(MyDataset )
Catch ex as Exception
End Try

End Function

Then set your component's datasource (say for example a DataGridView) to that Dataset:

DataGridView.DatSource = MyDataset.Table(0).DefaultView

Just don't forget to add the following to at the beginning of your code:

Imports System.Data.Sql
Impoert System.Data.SqlClient

Offline TDelight

  • Newbie
  • *
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: VB.NET Program with SQL SERVER ?
« Reply #2 on: March 30, 2010, 04:07:57 PM »
i THINK... you need to read about binding siguro po. or use applicable design patterns. wrapper classes and such. im not an expert po tho :)

also ung uhm api na din so you can check kung anu available sayo thru those classes that they mentioned
« Last Edit: March 30, 2010, 04:08:28 PM by TDelight »


Related Topics

  Subject / Started by Replies Last post
0 Replies
Last post October 01, 2008, 02:02:35 AM
by arpee
0 Replies
Last post January 06, 2009, 07:20:01 AM
by Corps
1 Replies
Last post March 30, 2010, 04:11:37 PM
by rpmolecule
0 Replies
Last post August 23, 2017, 10:59:22 AM
by GBTalk
0 Replies
Last post August 23, 2017, 11:00:56 AM
by Corps

Posting Disclaimer: Any individual may post a message in this forum and may do so anonymously. Therefore, the sole author is exclusively and entirely responsible for all opinions in that message. They do not represent the official opinions of Techronnati, its administrators or moderators or the Techronnati Management. Techronnati is merely acting as an impartial conduit for constitutionally protected free speech and is not responsible and will not be held liable for the content of such messages. All images and service logos are trademarks of their respective owners.