Click here to Skip to main content
15,925,400 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Newbie Pin
Dave Kreskowiak26-Sep-05 4:56
mveDave Kreskowiak26-Sep-05 4:56 
AnswerRe: Newbie Pin
shoaibnawaz26-Sep-05 12:19
shoaibnawaz26-Sep-05 12:19 
Questionproblem in updating data in sql table Pin
Anonymous26-Sep-05 3:37
Anonymous26-Sep-05 3:37 
AnswerRe: problem in updating data in sql table Pin
Dave Kreskowiak26-Sep-05 4:54
mveDave Kreskowiak26-Sep-05 4:54 
GeneralRe: problem in updating data in sql table Pin
Anonymous26-Sep-05 9:29
Anonymous26-Sep-05 9:29 
QuestionHow To Get Name of a Menu Item Pin
Gopi.V26-Sep-05 1:48
Gopi.V26-Sep-05 1:48 
AnswerRe: How To Get Name of a Menu Item Pin
Briga26-Sep-05 1:58
Briga26-Sep-05 1:58 
QuestionChaning button with an image Pin
Member 225908025-Sep-05 23:55
Member 225908025-Sep-05 23:55 
AnswerRe: Chaning button with an image Pin
_mubashir26-Sep-05 1:06
_mubashir26-Sep-05 1:06 
AnswerRe: Chaning button with an image Pin
_mubashir26-Sep-05 1:16
_mubashir26-Sep-05 1:16 
GeneralRe: Chaning button with an image Pin
Member 225908026-Sep-05 12:13
Member 225908026-Sep-05 12:13 
QuestionMusic with VB.NET Pin
Anonymous25-Sep-05 23:52
Anonymous25-Sep-05 23:52 
AnswerRe: Music with VB.NET Pin
Gopi.V26-Sep-05 1:36
Gopi.V26-Sep-05 1:36 
Questionis it possible.... Pin
icowa25-Sep-05 22:04
icowa25-Sep-05 22:04 
AnswerRe: is it possible.... Pin
rwestgraham26-Sep-05 8:01
rwestgraham26-Sep-05 8:01 
GeneralRe: is it possible.... Pin
icowa26-Sep-05 12:45
icowa26-Sep-05 12:45 
QuestionHow to use class for data accessing Pin
akhil.garg25-Sep-05 21:20
akhil.garg25-Sep-05 21:20 
AnswerRe: How to use class for data accessing Pin
Gopi.V26-Sep-05 1:42
Gopi.V26-Sep-05 1:42 
use this function for retrival

Public Function FetchData(ByVal tableName As String, Optional ByVal sql As String = "", Optional ByVal Transaction As OleDb.OleDbTransaction = Nothing, Optional ByVal mAddWithKey As Boolean = True) As DataTable
Dim tblData As DataTable
If sql = "" Then
DADPTable = New OleDb.OleDbDataAdapter("Select * from " & tableName, DataConnection)
Else
DADPTable = New OleDb.OleDbDataAdapter(sql, DataConnection)
End If
If Not Transaction Is Nothing Then
DADPTable.SelectCommand.Transaction = Transaction
End If
DADPTable.AcceptChangesDuringFill = True
If mAddWithKey Then DADPTable.MissingSchemaAction = MissingSchemaAction.AddWithKey
tblData = New DataTable(tableName)
DADPTable.Fill(tblData)
FetchData = tblData
tblData = Nothing
End Function

Use this function for update :

Public Sub UpdateData(ByVal tableName As DataTable, Optional ByVal Transaction As OleDb.OleDbTransaction = Nothing)
Dim commandBuild As OleDb.OleDbCommandBuilder
DADPTable = New OleDb.OleDbDataAdapter("Select Top 1 * from " & tableName, DataConnection)
If Not Transaction Is Nothing Then DADPTable.SelectCommand.Transaction = Transaction
Dim tblAdd As DataTable = ds.Tables(tableName).GetChanges(DataRowState.Added)
Dim tblModify As DataTable = ds.Tables(tableName).GetChanges(DataRowState.Modified)
Dim tblDelete As DataTable = ds.Tables(tableName).GetChanges(DataRowState.Deleted)

If Not tblAdd Is Nothing Then
If tblAdd.Rows.Count > 0 Then
commandBuild = New OleDb.OleDbCommandBuilder(DADPTable)
DADPTable.InsertCommand = commandBuild.GetInsertCommand()
If Not Transaction Is Nothing Then DADPTable.InsertCommand.Transaction = Transaction
DADPTable.Update(tblAdd)
End If
End If
If Not tblModify Is Nothing Then
If tblModify.Rows.Count > 0 Then
commandBuild = New OleDb.OleDbCommandBuilder(DADPTable)
DADPTable.UpdateCommand = commandBuild.GetUpdateCommand()
If Not Transaction Is Nothing Then DADPTable.UpdateCommand.Transaction = Transaction
DADPTable.Update(tblModify)
End If
End If
If Not tblDelete Is Nothing Then
If tblDelete.Rows.Count > 0 Then
commandBuild = New OleDb.OleDbCommandBuilder(DADPTable)
DADPTable.DeleteCommand = commandBuild.GetDeleteCommand()
If Not Transaction Is Nothing Then DADPTable.DeleteCommand.Transaction = Transaction
DADPTable.Update(tblDelete)
End If
End If
DADPTable = Nothing
commandBuild = Nothing
End Sub

V.Gopi.
Easy Design Systems
Coimbatore
India
Questionhow to save pdf files to SQL database? Pin
BORN...again!25-Sep-05 20:42
BORN...again!25-Sep-05 20:42 
QuestionHelp files Pin
JD_SA25-Sep-05 20:24
sussJD_SA25-Sep-05 20:24 
AnswerRe: Help files Pin
Briga25-Sep-05 21:36
Briga25-Sep-05 21:36 
Question.NET Themes Pin
Chetan Ranpariya25-Sep-05 18:56
Chetan Ranpariya25-Sep-05 18:56 
QuestionRe: Application Security Pin
Anonymous25-Sep-05 18:42
Anonymous25-Sep-05 18:42 
AnswerRe: Application Security Pin
Dave Kreskowiak26-Sep-05 1:36
mveDave Kreskowiak26-Sep-05 1:36 
QuestionHow i shutdown another PC in the network Pin
basant_kpg25-Sep-05 18:05
basant_kpg25-Sep-05 18:05 

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.