Yes, but i want to make it like datafill.transp ose (i know, that it
don't exists) or something like that.
But in my full aplication there will be about 50-100 columns.
I thought, that there is a way to transpose data in dataset and fill it
into other table (TableB). I created TableB with correct columns and i'm
trying to fill it. It's not qa problem, that Table or dataset will have
more columns then other one. How only fill rows?
My code:
Public Sub SQL_Wpis()
Dim sSQL As String
sSQL = "SELECT * FROM KanaSecRep"
Dim objConn As New SqlConnection(s Connection)
Dim objDataAdapter As New SqlDataAdapter( sSQL, objConn)
Dim objDS As New DataSet("KA_STA N")
Dim objInsertComman d As New SqlCommand
Dim sInsertSQL As String
Dim objParam As SqlParameter
If objConn.State = ConnectionState .Open Then
Try
objDataAdapter. MissingSchemaAc tion() = _
MissingSchemaAc tion.AddWithKey
objDataAdapter. Fill(objDS, "KanaSecRep ")
objConn.Close()
Dim objTable As DataTable
objTable = objDS.Tables("K anaSecRep")
Dim drRows As DataRowCollecti on
Dim objCurrentRow As DataRow
drRows = objTable.Rows
objConn.Open()
objDataAdapter. Update(objDS, "KanaSecRep ")
Dim sNowywpisSQLpiv = "INSERT INTO KanaSecRep" & "(Nazwastac ji, DC, MS,
Data, AuditBaseObject s, ShutdownWithout Logon" & " VALUES ('" &
strKomputer & "','" & IsDC(strKompute r) & "','" & IsMS(strKompute r) &
"','" & DateTime.Now & "','" & AuditBaseObject s(strKomputer) & "','" &
ShutdownWithout Logon(strKomput er) & "'
Dim objNewCmd As New SqlCommand(sNow ywpisSQLpiv, objConn)
objNewCmd.Execu teNonQuery()
Catch myException As System.Exceptio n
Console.WriteLi ne(myException. Message)
End Try
Console.Write(" Koniec")
End If
End Sub
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!