Hello Friends,
I am working on test project in which i am using Dataset. Now for data table i am able to findout the data type for particular column in dataset Table. for that i have written this code ---
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim obj As Object
Dim objSys As Object
Dim objS As Object
Try
dbConnectOpen(True)
ssql = "Select * from EMMFLDAT "
adpr_Generic = New OleDb.OleDbDataAdapter(ssql, getdbConnectString())
adpr_Generic.Fill(dSet_EMM, "EMMFLDAT_TAB")
dSet_EMM.Tables(0).Columns(i).DataType.ToString()
For i = 0 To dSet_EMM.Tables(0).Columns.Count - 1
MsgBox(dSet_EMM.Tables(0).Columns(i).DataType.ToString())
Next
Catch
End Try
End Sub
now my requirement is right now i am using particular table but if i want to create one generic function for any table so that i can use that data type value for my next assignment. And if that particular column in data table is having NULL value it shld write 0 (Zero) for Integer & date field and for String it shld write " " (Space). This is 51 fields data table. i want to use that one with case statement of all data types in VB.Net....
Your help is highly appriciated.
Thanking you
Abhijeet
I am working on test project in which i am using Dataset. Now for data table i am able to findout the data type for particular column in dataset Table. for that i have written this code ---
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim obj As Object
Dim objSys As Object
Dim objS As Object
Try
dbConnectOpen(True)
ssql = "Select * from EMMFLDAT "
adpr_Generic = New OleDb.OleDbDataAdapter(ssql, getdbConnectString())
adpr_Generic.Fill(dSet_EMM, "EMMFLDAT_TAB")
dSet_EMM.Tables(0).Columns(i).DataType.ToString()
For i = 0 To dSet_EMM.Tables(0).Columns.Count - 1
MsgBox(dSet_EMM.Tables(0).Columns(i).DataType.ToString())
Next
Catch
End Try
End Sub
now my requirement is right now i am using particular table but if i want to create one generic function for any table so that i can use that data type value for my next assignment. And if that particular column in data table is having NULL value it shld write 0 (Zero) for Integer & date field and for String it shld write " " (Space). This is 51 fields data table. i want to use that one with case statement of all data types in VB.Net....
Your help is highly appriciated.
Thanking you
Abhijeet