The 1C:Enterprise developers forum
Hello there.Is there a sample code that connects to a remote SQL database server?(ADO.NET, ODBC, etc etc)
Hi.Here is example:
Connection = New COMObject("ADODB.Connection"); Connection.Open("DRIVER={SQL Server};SERVER=...;DATABASE=...;USER=...;PASSWORD=..."); RS = New COMObject("ADODB.Recordset"); RS.ActiveConnection = Connection; RS.Open("SELECT * FR OM BANKS"); RS.MoveFirst(); While RS.EOF() = 0 Do Name = RS.Fields("NAME").Value; Message(Name); RS.MoveNext(); EndDo; RS.Close(); Connection.Close();
Hi.I want convert date to string?How can i do it?CStr(RS.Fields("RECDATE").Value) ???Convert / Parse / ToString() ??
Hi.There are several ways:
StringValue = Format(DateValue, "DF='dd.MM.yyyy HH:mm:ss'"); StringValue = String(DateValue); StringValue = "" + DateValue;