adodb

VBA Error handling on ADODB Connection.Open

偶尔善良 提交于 2020-01-02 05:46:11
问题 I have an ADODB connection in VBA for connecting to an SQLServer database. I want to catch the error that is raised when connection.Open is called and the given database is unreachable. My code looks like this: Public Function Connect() As Boolean On Error GoTo DBError Dim dbServer As String Dim dbName As String Dim dbUser As String Dim dbPwd As String dbServer = DatabaseSettings.dbServer dbName = DatabaseSettings.dbName dbUser = DatabaseSettings.dbUser dbPwd = DatabaseSettings.dbPwd Dim

Reading and working with strings longer than 255 with ADODB Excel 2010 VBA

对着背影说爱祢 提交于 2020-01-02 03:43:07
问题 Here' a thing for you guys: I want to read information from from a closed workbook using ADODB in VBA EXCEL. It happens that the strings in the cells in excel sometimes are with a length bigger than 255. And then here is this limitation: http://support.microsoft.com/kb/189897 "Your data may be truncated to 255 characters if the first 8 records for the field(s) being truncated contain 255 or fewer characters. The Microsoft Excel ODBC driver will, by default, scan the first 8 rows of your data

Using excels named range in a sql string in VBScript

半腔热情 提交于 2020-01-01 14:59:15
问题 I have searched on here and google but I still cannot solve my issue. I am trying to use an excel's named range equivalently in my .vbs file. The below works in VBA in excel but I cannot get it to work in a *.vbs file. ThisWorkbook.Sheets(1).Range("A1:B" & Range("B" & Rows.Count).End(xlUp).Row).Name = "DATA" strSql = "SELECT * FROM DATA" So, I have tried different variations of referencing to my named range DATA with no luck. This is what I have now: Set rng = ws.Range("A1:B2") rng = "DATA"

Running 'SET' command in SQL, prior to SELECT

北城余情 提交于 2019-12-31 04:23:04
问题 Following this question, I need to add something like SET LANGUAGE German; before my SELECT query. I am running the query in an ASP/VBScript web environment, which basically limits me, as far as I know, to a single query at a time. If I run a query such as - SET LANGUAGE German; SELECT..... I get a no results message, because the 'data' returned is from the SET query and not the SELECT that follows it. Is there anything that can be done to run the SET and the SELECT together in the ASP

Could not load type 'ADODB.FieldsToInternalFieldsMarshaler' from assembly

孤人 提交于 2019-12-30 08:34:08
问题 I have the following code: MAPITable mt = rStores.MAPITable; Recordset rs = new Recordset(); rs = mt.ExecSQL(@"SELECT EntryID, ""http://schemas.microsoft.com/mapi/proptag/0x0FF60102"" As PR_INSTANCE_KEY from Name"); while (!rs.EOF) { var fields = ((dynamic)rs.Fields); for (int f = 0; f < fields.Count; f++) { var field = fields[f]; var name = field.Name; var value = field.Value; } Debug.Print(rs.Fields["EntryID"].Value); Debug.Print(rs.Fields["PR_INSTANCE_KEY"].Value); rs.MoveNext(); When I

Could not load type 'ADODB.FieldsToInternalFieldsMarshaler' from assembly

天涯浪子 提交于 2019-12-30 08:34:01
问题 I have the following code: MAPITable mt = rStores.MAPITable; Recordset rs = new Recordset(); rs = mt.ExecSQL(@"SELECT EntryID, ""http://schemas.microsoft.com/mapi/proptag/0x0FF60102"" As PR_INSTANCE_KEY from Name"); while (!rs.EOF) { var fields = ((dynamic)rs.Fields); for (int f = 0; f < fields.Count; f++) { var field = fields[f]; var name = field.Name; var value = field.Value; } Debug.Print(rs.Fields["EntryID"].Value); Debug.Print(rs.Fields["PR_INSTANCE_KEY"].Value); rs.MoveNext(); When I

how do i handle concurrent inserts in mysql table and fetch the correct insert id

天大地大妈咪最大 提交于 2019-12-30 07:18:09
问题 I am using adodb for PHP library. For fetching the id at which the record is inserted I use this function "$db->Insert_ID()" I want to know if there are multiple and simultaneous inserts into the database table, will this method return me the correct inserted id for each record inserted ? The reason I am asking this is because I use this last insert id for further processing of other records and making subsequent entries in the related tables. Is this approach safe enough or am I missing

ADODBCould not load type 'ADODB.FieldsToInternalFieldsMarshaler' from assembly

烂漫一生 提交于 2019-12-28 12:18:14
问题 I'm trying to read an ADOBD.Recordset object like this (my first time, so pardon my "noobness" :D): Presentation.Category categorySvc = new Presentation.Category(); ADODB.Recordset categories = categorySvc.ListAll("BE", "DUE", "EN", 128); foreach (var category in categories.Fields) // here is where I get the exception { // ... } The ListAll call works fine - I get the Recordset with some data which I confirm that by doing a QuickWatch on the object. But when the code reach the categories

ADODB Connection.ConnectionString property doesn't return server name

China☆狼群 提交于 2019-12-25 18:24:17
问题 I am using ActiveX Data Objects 6.1 library in Excel VBA to access a SQL Server 2012 database. I can connect and run queries fine, but once connected there appears to be no way to determine which server the connection object is connected to, as the connectionString property does not return the same string that was used to open the connection: Public Sub connectDB() Dim conn As New Connection Dim strServer As String, strDatabase As String, strUser As String, strPassword As String strServer = "

ADODB Connection.ConnectionString property doesn't return server name

北慕城南 提交于 2019-12-25 18:23:03
问题 I am using ActiveX Data Objects 6.1 library in Excel VBA to access a SQL Server 2012 database. I can connect and run queries fine, but once connected there appears to be no way to determine which server the connection object is connected to, as the connectionString property does not return the same string that was used to open the connection: Public Sub connectDB() Dim conn As New Connection Dim strServer As String, strDatabase As String, strUser As String, strPassword As String strServer = "