hai
Try to move connect.open outside of For Loop.bcz first time it will open and if goes second time u try to open connection,but connection already open,so try to move out of con.open and con.close form For Loop. or try to close con after MDBCommitTrans()
Try like this
Dim connect As New OleDb.OleDbConnection
connect.ConnectionString = strcLocalProp.m_strLocalDBConnStr
connect.Open()
For i = 0 To (arrDirInfo.Count - 1)
strSQL = "INSERT into tblMallDir VALUES (?,?,?,?,?,?);"
MDBBeginTrans()
Dim command As New System.Data.OleDb.OleDbCommand(strSQL, connect)
command.Parameters.AddWithValue("@dirno", arrDirInfo.Item(i).strShopNo)
command.Parameters.AddWithValue("@dirname", arrDirInfo.Item(i).strShopName)
command.Parameters.AddWithValue("@dirdetails", arrDirInfo.Item(i).strShopDetails)
command.Parameters.AddWithValue("@category", arrDirInfo.Item(i).strCategory)
command.Parameters.AddWithValue("@level", arrDirInfo.Item(i).strLevel)
command.Parameters.AddWithValue("@lotno", arrDirInfo.Item(i).strLotNo)
intRec = command.ExecuteNonQuery()
command.Dispose()
MDBCommitTrans()
Next
connect.Close()
Dim connect As New OleDb.OleDbConnection
connect.ConnectionString = strcLocalProp.m_strLocalDBConnStr
For i = 0 To (arrDirInfo.Count - 1)
connect.Open()
strSQL = "INSERT into tblMallDir VALUES (?,?,?,?,?,?);"
MDBBeginTrans()
Dim command As New System.Data.OleDb.OleDbCommand(strSQL, connect)
command.Parameters.AddWithValue("@dirno", arrDirInfo.Item(i).strShopNo)
command.Parameters.AddWithValue("@dirname", arrDirInfo.Item(i).strShopName)
command.Parameters.AddWithValue("@dirdetails", arrDirInfo.Item(i).strShopDetails)
command.Parameters.AddWithValue("@category", arrDirInfo.Item(i).strCategory)
command.Parameters.AddWithValue("@level", arrDirInfo.Item(i).strLevel)
command.Parameters.AddWithValue("@lotno", arrDirInfo.Item(i).strLotNo)
intRec = command.ExecuteNonQuery()
command.Dispose()
MDBCommitTrans()
connect.Close()
Next