I can connect to it and get the column names, etc. But it doesn't retrieve any records and I don't know why! I have tried a few different ways, but nothing seems to work. What am I doing wrong?? Here's my code: // string query = @"SELECT * FROM CONNTEST\FLOW_1"; string DBConnection = @"Provider=WinCCOLEDBProvider.1;DataSource=Laptop\WinCC;Catalog=CC_Connecti_06_07_29_15_50_04R;"; string SqlStr = @"TAG:R,'CONNTEST\FLOW_1','0000-00-00 00:10:00.000','0000-00-00'"; //string SqlStr = @"TAG:R,'CONNTEST\FLOW_1','0000-00-00 00:30:00.000','0000-00-00 00:00:00.000'"; // TAG:R,'CONNTEST\FLOW_1','0000-00-00 00:30:00.000','0000-00-00 00:00:00.000' //string SqlStr = "TAG:R,1,'0000-00-00 00:30:00.000','0000-00-00 00:00:00.000'"; //Open Recordset via Connection object. //string SqlStr = @"TAG:R,'CONNTEST\FLOW_1','0000-00-00 00:01:00','0000-00-00 00:00:00"; // 1: Make Connection to Database ADODB.ConnectionClass Conn = new ADODB.ConnectionClass(); Conn.ConnectionString = DBConnection; Conn.CursorLocation = CursorLocationEnum.adUseServer; Conn.Open(DBConnection, "", "", 0); // Conn = Server.CreateObject("ADODB.Connection"); // 2: Use the command text query ADODB.CommandClass OCom = new ADODB.CommandClass (); OCom.CommandType = ADODB.CommandTypeEnum.adCmdText; OCom.ActiveConnection = Conn; OCom.CommandText = SqlStr; // 3: Create the RecordSet and fill with the data //'ADODB.RecordsetClass rs = new ADODB.RecordsetClass(); //rs.Open(SqlStr,DBConnection,ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic, -1); //'rs.Open(OCom, Type.Missing, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockBatchOptimistic, -1); object dummy = Type.Missing; ADODB.Recordset rs = OCom.Execute(out dummy, ref dummy, 0); object GetName; GetName = rs.RecordCount; ////////GetName = rs.Fields[1].Value;
VanEtienne
Posts
-
How to retrieve records from a ADODB with c# -
System tray iconI wrote a C# windows application, in Visual Studio 2005, that will email certain files to certain people at a certain time every day. This program have to run permanantly to check the time. How do I make the program run in the background and have only a system tray icon on which you click to maximize the app?? -- modified at 7:28 Tuesday 25th April, 2006
-
creating webparts for sharepoint servicesPlease anyone help! I want to create web parts for sharepoint services 2. How can I do it in visual studio 2005. When I want to open my sharepoint services page with vs2005 it sais that vs2005 doen't support it. The sharepoint services pages are .aspx files. Any sugestions on creating web parts in a different way is welcome. Have tried in Frontpage 2000. Some pages worked, other gave an error after I changed it. :confused: :confused: :confused: :confused: :confused:
-
C# Video Screen ShotsSorry I can't help, but I also made a screen capturing util. Also only displayed black where the video was supposed to be, didn't know it was because of hardware acceleration! Thanx, now at least I know why it only displayed black. :)
-
See who/what program changed a fileI downloaded a free dll, called iTextSharp, which you use to create and read pdf files. With that i got the information. Title, Author, Producer, Creator, Creation Time and Modified Time. When the file is changed (in my case OCRed), the Producer changes, depending on what program changed it. Then I can see if a pdf have been OCRed. Thanx for replying:)
-
See who/what program changed a fileOK, thanx
-
See who/what program changed a fileYes I know about the FileWatcher, but thnx anyway!
-
See who/what program changed a fileSimilar to the FileWatcher, which checks a folder and see when a file changes. I want to see this info on files that have already been changed. All I can get to is the time of the creation time, attributes, last access and last write times. I want to see who/what program changed the file. (Metadata) Please can anybody help!? -- modified at 2:37 Thursday 16th February, 2006
-
passing a structGives me: The type or namespace name 'namespace1' could not be found (are you missing a using directive or an assembly reference?) The type or namespace name 'DrawGraph' could not be found (are you missing a using directive or an assembly reference?) I want to send about 30 variables through the struct, coz with struct its easy and nice to access or change the values of variables. I've read somewhere that its not good to send too much through a struct. Should I just send the variables directly then?
-
passing a structWorks if both classes are in the same file, but I want to do it between 2 different files. //DrawGraph.cs public partial class DrawGraph { public struct Data { public int a; } public void DoSomething() { Draw draw = new Draw(); //Create an instance of Draw.cs class file Data data = new Data(); //Create an instance of Data struct data.a = 5; Image1.ImageUrl = draw.DrawGraph2(data); //Sending struct to Draw.cs class,DrawGraph2 method } } //Draw.cs public class Draw { public String DrawGraph2(@Data@ data) // what must I put between the @ signs { String img = "whatever"; return img; } }
-
passing a structHi, can someone please tell me how to send a struct to a different class file. In the other class file (receiving end) you have to specify the type that is sent to it. What must I put there, 'struct' doen't work.