|
1. System.Data.OleDbClient
2. SqlConnection,SqlCommand and OleDbConnection,OleDbCommand can execute SQL statements. You can use an OleDbDataReader (SQlDataReader if MSSQL) to retun records in a fast forwar-only cursor and do as you wish with the data. xxxCommand and xxxConnection can also execute quries that have no return data or onlay a single scalar value.
Genius may have its limitations, but stupidity is not thus handicapped. - Elbert Hubbard
|
|
|
|
|
Thanks Rob,
but that's not exactly what I was looking for.
I suspect I'll end up moving to C++ one way or the other
Thanks again,
F.O.R.
|
|
|
|
|
Look at the System.Data.Odbc (only in 1.1) and System.Data.OleDb namespaces for setting up connections and executing commands etc.
The OdbcCommand and OleDbCommand objects both have the ExecuteNonQuery method (and more) to execute SQL statements without involving DataSet and DataTable objects...
|
|
|
|
|
Hmmm...
..I didn't know that 1.1 had an Odbc namespace!
I'll take a look, thanks
F.O.R.
|
|
|
|
|
While the previous answers were complete and technically correct, why do I still have the feeling you are using the wrong tool for the job?
You can do it on anything you choose - from .bat to .net - A customer
|
|
|
|
|
Because indeed I am.
I am looking for something that has a 1:1 correspondence to the sql.h library from C/C++.
Now, while C# has alternatiuve ways to achieve the same goals (all of the Data namespace, for instance), I am not surprized to find that C# keeps you away from such low level kind of stuff.
It indeed makes much more sense for me to use a C++ (managed or not) app in this case,
but I figured I could look around for a bit before giving up on being more modern
F.O.R.
|
|
|
|
|
OK, before I give up on this, let me rephrapse the question
Any way I can stick in a C# App the following lines?
<br />
sqlr = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &h_env);<br />
sqlr = SQLSetEnvAttr(h_env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, SQL_IS_UINTEGER);<br />
and other statements like that ?
They are taken from a C/C++ app that includes <sql.h> and <sqlext.h>.
Maybe I can place them in an un-managed section?
It would solve soooo many problems !
Thanks in advance for any input,
F.O.R.
|
|
|
|
|
This is just a shot in the dark but you could take a look at addng a COM reference to the Microsoft SQLDMO Object Library. You might find what you need in there.
|
|
|
|
|
if anyone have a good idea about how to creat an html to image component
i tried :
A.
capture a web browser controll
prob
1. a win form app , we need to put the web controll inside A dll file. and that a little messy ...
2.when u capture it will only get what u c ...
and not the whole page.
B.
generating a url file on the server
then open this file with the windows shell getting the
image that gnerated by the server
prob. wont work on windows 2003 server.
Any help or idea would be most welcome !
|
|
|
|
|
try to start search from here:
Thumbnail Generator Web Service
Description: The Thumbnail Generator Web Service creates a .gif image of a specified URL.
<br />
http:
<br />
http:
Found from here:
<br />
http:
"I have not failed.
I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
|
|
|
|
|
thnx for the reply,
i alrady tried the web service , its very nice but wont work on the 2003 servers, or xp machine u get an exception when u try to extract the image with the iextractimage interface ,
the same code work with win 2000 wont work with 2003 ...
|
|
|
|
|
Never saw this on work Sorry - once I've searched the net for this info and this what I found. Never used it and didn't know if this work.
P.S. This is strange that some interfaces (!!!) doesn't work somewhere May be it's depends on browser version ??
"I have not failed.
I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
|
|
|
|
|
I have seen several helpful examples of how to call API functions but I am confused about translating the data types. For example, I have seen DWORD parameters translated to both int and uint in c#. I am using a function that has a char[] parameter which I think should be translated as sbyte, but I'm just not sure. Any direction on a good reference for this?
Tym!
|
|
|
|
|
Try this: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cscon/html/vclrfcomparisonbetweenccsharp.asp
Glenn
|
|
|
|
|
|
I have a richtext control, is there a way to count number of words or do I make my own function?
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
This will work assuming only one space is between each word:
this.richTextBox1.Text.Trim().Split(" ".ToCharArray()).Length;
|
|
|
|
|
Is there any way of obtaining the height of a main menu (menubar) or is it always the same size regardless of the screen resolution (i think its 20 pixels).
The reason why i need to know the height is that i'm trying to make a form with a picturebox inside a panel and resize the form so that it can view the whole image (assuming that my screen res is larger than the image). So i need to do some calculations and stuff..
|
|
|
|
|
Assuming you aren't using owner drawn menus the menu height is given by System.Windows.Forms.SystemInformation.MenuHeight .
James
"then when you go to bed...wait, you dont do that do you....ok....when you plug into the 'hive mind' to charge yourself, ill hack into your head"
Nnamdi Onyeyiri over MSN
|
|
|
|
|
Thanks. That did the trick.
|
|
|
|
|
I'm trying to call the Win32 SDK function CreateCompatibleDC in my application, I declared the function like this:
[DllImport("gdi32.dll")]
protected static extern IntPtr CreateCompatibleDC(IntPtr hDC);
but whenever i call it (with the hDC as IntPtr.Zero) it fails. When I check the error using the GetLastError function it is error 8, not enough memory. Why would this happen, I have plenty of RAM? Is there something i'm doing wrong?
Any help would be greatly appriciated,
thanks in advance,
dave
Dave Kerr
focus_business@hotmail.com
http://www.codechamber.com
|
|
|
|
|
Try the following:
[DllImport("user32.dll")]
public static extern IntPtr GetDC(IntPtr hWnd);
public static extern IntPtr CreateCompatibleDC(IntPtr HDC);
[DllImport("gdi32.dll")]
IntPtr ScreenDC = GetDC(IntPtr.Zero);
IntPtr NewDC = CreateCompatibleDC(ScreenDC);
HTH
-Nick Parker
|
|
|
|
|
Hi nick,
i tried what you suggested but I still have the same problem, i'm getting *something* back from the CreateCompatibleDC call, but when i check for errors, it still gives error 8. Then I create a DIB Section using CreateDIBSection from the HDC (and other data) and try and call SetPixelFormat on it, and SetPixelFormat never ever works, it always gives error '1'. Its to create an OpenGL compatible DIB Section, and i just cant do it!
Any ideas?
Cheers,
dave
Dave Kerr
focus_business@hotmail.com
http://www.codechamber.com
|
|
|
|
|
Try changing the DllImport so that the SetLastError field is set to true.
[DllImport("gdi32.dll", SetLastError=true)] , this tells the marhsaller to call GetLastError for you. You can then get the error code by calling DllImportAttribute.GetLastWin32Error() . It may not make any major changes, but it ensures that another Win32 call won't change the value, especially if that call is made by the framework.
James
"then when you go to bed...wait, you dont do that do you....ok....when you plug into the 'hive mind' to charge yourself, ill hack into your head"
Nnamdi Onyeyiri over MSN
|
|
|
|
|
I've an xxx.aspx page which has couple buttons. Based on button click I'm loading ascx files using
Case 1
Page.LoadControl("xxx.ascx")
Case 2
Page.LoadControl("yyy.ascx")
...
...
In my xxx.ascx and yyy.ascx files, I've a grid control which I want to populate using "BindGrid()" method only
if (!Page.IsPostBack)
But it appears to me when I use "if (!Page.IsPostBack)", the binding doesn't happen and if I remove it it works fine. In simple words, looks like there's no PostBack when it comes to LoadControl.
I want to use "if (!Page.IsPostBack)" because for everything I'm doing with grid calls the PageLoad eachtime like if I click on "Next Page" (i've paging enabled for the grid), it calls PageLoad and same PageLoad is called when "Prev Page" is clicked.
Somehow I want the ascx PageLoad to appear once rather than each time.
Any Suggestions? Comments?
I really need some help.
|
|
|
|