Click here to Skip to main content
15,915,674 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionneed help on database connection! Pin
peteyshrew17-Apr-07 0:42
peteyshrew17-Apr-07 0:42 
AnswerRe: need help on database connection! Pin
ganero17-Apr-07 1:25
ganero17-Apr-07 1:25 
GeneralRe: need help on database connection! Pin
peteyshrew17-Apr-07 1:32
peteyshrew17-Apr-07 1:32 
GeneralRe: need help on database connection! Pin
ganero17-Apr-07 1:50
ganero17-Apr-07 1:50 
GeneralRe: need help on database connection! Pin
peteyshrew17-Apr-07 2:05
peteyshrew17-Apr-07 2:05 
GeneralRe: need help on database connection! Pin
Dayekh17-Apr-07 2:40
Dayekh17-Apr-07 2:40 
GeneralRe: need help on database connection! Pin
shreekar17-Apr-07 19:22
shreekar17-Apr-07 19:22 
AnswerRe: need help on database connection! Pin
klaydze17-Apr-07 22:00
klaydze17-Apr-07 22:00 
Imports System.Data.Oledb

Dim con as new Oledb.OledbConnection("Provider=Microsoft.Jet.Oledb.4.0; " & _
"Data Source=dbase.mdb")
NOTE: Put this code under the Public Class Form1

CODE OF BUTTON SAVE:

Dim objDataAdapter As New OleDb.OleDbDataAdapter
Dim objCommand As New OleDb.OleDbCommand
Dim objDataTable As New DataTable
Dim objDataSet As New DataSet
Dim objOleCon As New OleDb.OleDbConnection

Dim strInsert As String
Dim strSelect As String

Try
strSelect = "Select * from Table1"
strInsert = "Insert into Table1 (name,address) Values('" & tname.text & "','" & taddress.text & "')"

objOleCon = New OleDb.OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0; " & _
"Data Source=dbase.mdb")

objDataAdapter.SelectCommand = New OleDb.OleDbCommand(strInsert, objOleCon)
objDataAdapter.Fill(objDataSet)
objDataTable = objDataSet.Tables(0)

With objCommand
.Connection = objOleCon
.Connection.Open()
.CommandText = strInsert
.CommandType = CommandType.Text
.ExecuteNonQuery()
.Connection.Close()
End With

MsgBox("Record Saved")

Catch ex As Exception
MsgBox(ex.Message)
End Try

Don't block the drive way of all the newbies in programming. Smile | :) )

QuestionAccess Outlook Express through VB.NET Pin
Moin.A17-Apr-07 0:06
Moin.A17-Apr-07 0:06 
AnswerRe: Access Outlook Express through VB.NET Pin
Dave Kreskowiak17-Apr-07 7:38
mveDave Kreskowiak17-Apr-07 7:38 
Questionvalidation of form Pin
kripa2117-Apr-07 0:03
kripa2117-Apr-07 0:03 
AnswerRe: validation of form Pin
CPallini17-Apr-07 1:36
mveCPallini17-Apr-07 1:36 
GeneralRe: validation of form Pin
kripa2117-Apr-07 1:51
kripa2117-Apr-07 1:51 
JokeRe: validation of form Pin
CPallini17-Apr-07 2:07
mveCPallini17-Apr-07 2:07 
QuestionSaving data on a user control that is placed inside a tab control Pin
steve_rm16-Apr-07 23:17
steve_rm16-Apr-07 23:17 
QuestionLooping through tab in a tab control Pin
steve_rm16-Apr-07 20:43
steve_rm16-Apr-07 20:43 
AnswerRe: Looping through tab in a tab control Pin
Werries16-Apr-07 21:48
Werries16-Apr-07 21:48 
AnswerRe: Looping through tab in a tab control Pin
Enriad16-Apr-07 21:50
Enriad16-Apr-07 21:50 
GeneralRe: Looping through tab in a tab control Pin
steve_rm16-Apr-07 22:35
steve_rm16-Apr-07 22:35 
QuestionRemove a Control Array Label Pin
coldude16-Apr-07 20:31
coldude16-Apr-07 20:31 
QuestionXml Node Defining Pin
MatrixCoder16-Apr-07 20:21
MatrixCoder16-Apr-07 20:21 
Questionsaving problems Pin
Xmen Real 16-Apr-07 19:46
professional Xmen Real 16-Apr-07 19:46 
AnswerRe: saving problems Pin
Marek Grzenkowicz16-Apr-07 20:56
Marek Grzenkowicz16-Apr-07 20:56 
GeneralRe: saving problems Pin
Xmen Real 16-Apr-07 21:27
professional Xmen Real 16-Apr-07 21:27 
QuestionHow to calculate the time difference Pin
re infecta16-Apr-07 19:41
re infecta16-Apr-07 19:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.