Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
9Activity
0 of .
Results for:
No results containing your search query
P. 1
Convert DataTable to RecordSet

Convert DataTable to RecordSet

Ratings:

4.75

(1)
|Views: 3,445|Likes:
Published by Muneeb Khan

More info:

Published by: Muneeb Khan on Nov 22, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as TXT, PDF, TXT or read online from Scribd
See more
See less

11/30/2012

pdf

text

original

 
Public Function convertToADODB(ByRef table As DataTable) As ADODB.Recordset'TryDim result As New ADODB.Recordsetresult.CursorLocation = CursorLocationEnum.adUseClientDim resultFields As ADODB.Fields = result.FieldsDim col As DataColumnFor Each col In table.ColumnsresultFields.Append(col.ColumnName, TranslateType(col.DataType),col.MaxLength, col.AllowDBNull = ADODB.FieldAttributeEnum.adFldIsNullable)Nextresult.Open(System.Reflection.Missing.Value,ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic, 0)For Each row As DataRow In table.Rowsresult.AddNew(System.Reflection.Missing.Value,System.Reflection.Missing.Value)For i As Integer = 0 To table.Columns.CountresultFields(i).Value = row(i)NextNextReturn result'Catch ex As Exception'End TryEnd FunctionPublic Function TranslateType(ByRef type As Type) As ADODB.DataTypeEnumTrySelect Case type.UnderlyingSystemType.ToStringCase "System.Boolean"Return ADODB.DataTypeEnum.adBooleanCase "System.Byte"Return ADODB.DataTypeEnum.adUnsignedTinyIntCase "System.Char"Return ADODB.DataTypeEnum.adCharCase "System.DateTime"Return ADODB.DataTypeEnum.adDateCase "System.Decimal"Return ADODB.DataTypeEnum.adCurrencyCase "System.Double"

Activity (9)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
AndroDgebuadze liked this
Heng Ariana liked this
Gonzalo Newton liked this
bugmenot540 liked this
ALi liked this
Luis Bullido liked this
Luis Bullido liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->