Click here to Skip to main content
15,894,343 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionsaving data problem when using function for dataadapter and data set Pin
hemrk22-Jul-09 5:18
hemrk22-Jul-09 5:18 
have created function in class file.
Public Shared Function dsCntrctET() As DataSet
Dim sqlCntrct As String = "Select * from CNTRCT_ET where CNTRCT_ID=" & CISCNO
Dim cmdCISContract As New OracleCommand
Dim daCISCntrct As New OracleDataAdapter
Dim dsCISCntrct As New DataSet
Dim cmdCISBuilder As New OracleCommandBuilder
Try
With cmdCISContract
.Transaction = myTransCIS
.CommandText = sqlCntrct
.Connection = cnCIS
End With
daCISCntrct = New OracleDataAdapter(cmdCISContract)
daCISCntrct.FillSchema(dsCISCntrct, SchemaType.Source)
cmdCISBuilder = New OracleCommandBuilder(daCISCntrct)
With daCISCntrct
.TableMappings.Add("Table", "CNTRCT_ET")
.Fill(dsCISCntrct)
.SelectCommand = cmdCISContract
.InsertCommand = cmdCISBuilder.GetInsertCommand
.UpdateCommand = cmdCISBuilder.GetUpdateCommand
.DeleteCommand = cmdCISBuilder.GetDeleteCommand
End With

Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Return (dsCISCntrct)
End Function

it returns dataset that i can use for getting value from table.
but while saving data, i have to use dataadapter for da.update(ds,"table") and ds.acceptchanges.

this i have to use in multiple forms as this data comes from 3rd party so i dont want to write this in every form . so i thought how to return data adapter and dataset from the same function. as i wanted to use daCISCntrct and dsCISCntrct.

When i am saving data , and i call CISCLASS.daCISCntrct.update(CISCLASS.dsCIScntrct,"Table_Name")..it goes to function and initialize datadapter and not saving new data . it not giving me error but if i look at table, it has all old data where as if i write this code in private sub procedure , its saving data and next time i see new data in the table.
Please reply me asap.
Thanks in adavance.
AnswerRe: saving data problem when using function for dataadapter and data set Pin
DoctorMick22-Jul-09 6:20
DoctorMick22-Jul-09 6:20 
GeneralRe: saving data problem when using function for dataadapter and data set Pin
hemrk22-Jul-09 7:56
hemrk22-Jul-09 7:56 
QuestionProject Publish Pin
Paramu197322-Jul-09 4:57
Paramu197322-Jul-09 4:57 
AnswerRe: Project Publish Pin
Vimalsoft(Pty) Ltd22-Jul-09 5:09
professionalVimalsoft(Pty) Ltd22-Jul-09 5:09 
GeneralRe: Project Publish Pin
Paramu197322-Jul-09 5:20
Paramu197322-Jul-09 5:20 
GeneralRe: Project Publish Pin
Vimalsoft(Pty) Ltd22-Jul-09 20:05
professionalVimalsoft(Pty) Ltd22-Jul-09 20:05 
QuestionOutlook Add-In Setup Problem Pin
dcdhingra22-Jul-09 3:40
dcdhingra22-Jul-09 3:40 
Questionhow to generate reports using crystal report in vb Pin
myperacq22-Jul-09 0:07
myperacq22-Jul-09 0:07 
AnswerRe: how to generate reports using crystal report in vb Pin
Steven J Jowett22-Jul-09 1:49
Steven J Jowett22-Jul-09 1:49 
QuestionError :The Workgroup information file is missing or opeaned exclusively by another user Pin
rhtbhegade22-Jul-09 0:02
rhtbhegade22-Jul-09 0:02 
AnswerRe: Error :The Workgroup information file is missing or opeaned exclusively by another user Pin
Ashfield22-Jul-09 1:51
Ashfield22-Jul-09 1:51 
GeneralRe: Error :The Workgroup information file is missing or opeaned exclusively by another user Pin
riced22-Jul-09 4:27
riced22-Jul-09 4:27 
GeneralRe: Error :The Workgroup information file is missing or opeaned exclusively by another user Pin
Ashfield22-Jul-09 5:33
Ashfield22-Jul-09 5:33 
QuestionCeate setup of window application Pin
Mamta.Sahu21-Jul-09 23:08
Mamta.Sahu21-Jul-09 23:08 
AnswerRe: Ceate setup of window application Pin
Tom Deketelaere21-Jul-09 23:50
professionalTom Deketelaere21-Jul-09 23:50 
AnswerRe: Ceate setup of window application Pin
dcdhingra22-Jul-09 0:12
dcdhingra22-Jul-09 0:12 
QuestionOutlook Addin Instance Creation problem... Pin
dcdhingra21-Jul-09 21:59
dcdhingra21-Jul-09 21:59 
AnswerRe: Outlook Addin Instance Creation problem... Pin
tosch21-Jul-09 22:54
tosch21-Jul-09 22:54 
GeneralRe: Outlook Addin Instance Creation problem... Pin
dcdhingra21-Jul-09 23:37
dcdhingra21-Jul-09 23:37 
QuestionWhere can I find the source code of.. Pin
biman.r21-Jul-09 18:51
biman.r21-Jul-09 18:51 
AnswerRe: Where can I find the source code of.. Pin
Adam R Harris21-Jul-09 19:02
Adam R Harris21-Jul-09 19:02 
AnswerRe: Where can I find the source code of.. Pin
Christian Graus21-Jul-09 19:44
protectorChristian Graus21-Jul-09 19:44 
AnswerRe: Where can I find the source code of.. Pin
Nagy Vilmos21-Jul-09 23:55
professionalNagy Vilmos21-Jul-09 23:55 
AnswerRe: Where can I find the source code of.. Pin
0x3c022-Jul-09 1:40
0x3c022-Jul-09 1:40 

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.