sdohertyccb
Board Regular
- Joined
- Feb 15, 2005
- Messages
- 91
Can anyone help me with the following code, I am trying to write a Function that will execute a query and show the results. This is as far as I have been able to get with my limited knowledge, any help will be greatly appreciated...
In case you are wondering, I have verified that the connection is avaiable and works in the followign code
<font face=Courier New><SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Function</SPAN> sql(<SPAN style="color:#00007F">ByVal</SPAN> query <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>)<br>****<SPAN style="color:#00007F">If</SPAN> (g_Conn <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN>) <SPAN style="color:#00007F">Then</SPAN><br>********<SPAN style="color:#00007F">Call</SPAN> getCon<br>****<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br><br>****g_Sql = query<br>****<SPAN style="color:#00007F">Set</SPAN> g_RS = g_Conn.Execute(g_Sql, , adCmdText)<br> <br>****<SPAN style="color:#00007F">If</SPAN> g_RS.EOF = <SPAN style="color:#00007F">False</SPAN> <SPAN style="color:#00007F">Then</SPAN><br>********g_RS.MoveFirst<br>********sql = g_RS.Fields(query)<br>****<SPAN style="color:#00007F">Else</SPAN><br>********sql = ""<br>****<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>****g_RS.Close<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Function</SPAN></FONT>
In case you are wondering, I have verified that the connection is avaiable and works in the followign code
<font face=Courier New><SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Function</SPAN> sql(<SPAN style="color:#00007F">ByVal</SPAN> query <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>)<br>****<SPAN style="color:#00007F">If</SPAN> (g_Conn <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN>) <SPAN style="color:#00007F">Then</SPAN><br>********<SPAN style="color:#00007F">Call</SPAN> getCon<br>****<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br><br>****g_Sql = query<br>****<SPAN style="color:#00007F">Set</SPAN> g_RS = g_Conn.Execute(g_Sql, , adCmdText)<br> <br>****<SPAN style="color:#00007F">If</SPAN> g_RS.EOF = <SPAN style="color:#00007F">False</SPAN> <SPAN style="color:#00007F">Then</SPAN><br>********g_RS.MoveFirst<br>********sql = g_RS.Fields(query)<br>****<SPAN style="color:#00007F">Else</SPAN><br>********sql = ""<br>****<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>****g_RS.Close<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Function</SPAN></FONT>
Last edited: