1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
cnn1.ConnectionString = "SERVER=(local);Database=CRMbvsi_MSCRM;integrated Security=SSPI"
cnn1.Open()
For i = 0 To Grd1.Rows.Count - 1
cmd1.CommandText = "select * from SystemUserBase WHERE Firstname ='" & Grd1.Item(6, i).Value & "' and Lastname='" & Grd1.Item(5, i).Value & "'"
cmd1.Connection = cnn1
curs1 = cmd1.ExecuteReader()
cmd.CommandText = "INSERT INTO AccountBase (AccountId, AccountNumber, Name, Telephone1, Fax, EMailAddress1, DeletionStateCode, OwningUser, OwningBusinessUnit,StateCode) VALUES ( NEWID() ,'" & Grd1.Item(0, i).Value & "' , '" & Grd1.Item(1, i).Value & "', '" & Grd1.Item(2, i).Value & "', '" & Grd1.Item(3, i).Value & "', '" & Grd1.Item(4, i).Value & "', 0,'" & curs1("SystemeUserId") & "', '" & curs1("BuisinessUnitId") & "', 0)"
cmd.Connection = cnn1
cmd.ExecuteScalar()
Next
curs1.close()
cnn1.close() |
Partager