|
With just one indexer (lastUpdatedRecord ) you reference a single row, but when you use 2 indexers, you can access a single cell:
mydatatable.Rows[lastUpdatedRecord][columnNumber] = newValue;
Regards,
mav
|
|
|
|
|
Sorted...Thanks mav
Your A king!
|
|
|
|
|
Is there a CodeParser concrete class to parse C++ code?
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|
|
There are tools available. Look for programmar in google.
Live Life King Size
Alomgir Miah
|
|
|
|
|
None that I know of. I know for sure that the .NET Framework doesn't have one, but I'm not sure about the availability of 3rd party implementations.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Try www.antlr.org or www.devincook.com/goldparser.
|
|
|
|
|
I have successfully called a Fortran dll from unmanaged C++ and now I'm trying this in C#.
This is my attempt:
<br />
class MyClass {<br />
[DllImport(@"square.dll", EntryPoint="aFunc")]<br />
public static extern void aFunc(out int aNum);<br />
public static int Main() {<br />
int aNum=20;<br />
aFunc(out aNum);<br />
Console.WriteLine(aNum);<br />
return 0;<br />
}<br />
}<br />
The dll merely squares the number and sends it back out. The error message is System.DllNotFoundException. I think the reason is that I'm not able to add reference. It keeps saying that it's not a valid .COM or .dll !
Suggestions greatly welcomed.
Kash
|
|
|
|
|
You need to add the DLL path to the PATH environment variable or you can just copy the DLL in the same folder as your managed assemblies.
Live Life King Size
Alomgir Miah
|
|
|
|
|
I managed to get it to work by putting the .lib and .dll file in bin\Release folder but now I have some new problems.
This works to an extent.
The number goes in OK, and does the calc inside the dll correctly but the new number is not sent back. I tried both "out" and "ref" declarations.
class MyClass<br />
{<br />
[DllImport(@"square.dll", EntryPoint="aFunc")]<br />
<br />
public static extern void aFunc(float aNum);<br />
<br />
public static int Main() <br />
{<br />
float aNum=20.0F;<br />
aFunc(aNum);<br />
Console.WriteLine(aNum);<br />
return 0;<br />
}<br />
}<br />
}
|
|
|
|
|
Kash wrote:
public static extern void aFunc(float aNum);
Of course not. Since you've told C# that the return type for the funtion is void, it's not expecting any return value. What this code is supposed to look like depends heavily on what the function declaration in your C++ code looks like. Without knowing that...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The actual dll is written in Fortran and I performaed a test in C++ using a void function declaration and it worked. What I'm trying to do is do the same in C#. I'm very new to C#, sorry if this is basic.
I've tried putting the code in an unsafe context but still not returning xo althought both xi and xo (xi**2) in the dll are correct.
class MyClass<br />
{<br />
[DllImport(@"square.dll", EntryPoint="aFunc")]<br />
<br />
unsafe public static extern void aFunc(float xi, out float * xo);<br />
<br />
public static int Main() {<br />
float xi=20.0F;<br />
unsafe {<br />
float * xo;<br />
aFunc(xi,out xo);<br />
Console.WriteLine(*xo);<br />
}<br />
return 0;<br />
}<br />
}<br />
}
thanks in advance.
|
|
|
|
|
OK, now the function definition changed. You're no longer passing one parameter, but two.
One more time -> WITHOUT SEEING THE ORIGINAL FUNCTION DEFINITION, IT'S IMPOSSIBLE TO TELL YOU WHAT YOU'RE DOING WRONG!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
subroutine aFunc(xi,xo)
real , intent(in) :: xi
real , intent(out) :: xo
!
!DEC$ATTRIBUTES dllexport :: aFunc
!DEC$ATTRIBUTES DEFAULT,STDCALL, DECORATE, ALIAS: 'aFunc' :: aFunc
!
xo = xi*xi
end subroutine aFunc
|
|
|
|
|
I need help remotely connecting to a database. I have a workstation named EC-BJACOB with my database on it. I'm also running the SQL Server Manager (service: SQL Server) on that workstation. So far I've been coding my application on the same worktsation and have had no trouble connecting to the database to run my SQL queries against it.
The application is ready to be tested remotely, however, and I'm running into problems. When I run the application from my laptop comuter (which is joined to the same network), I get the following error:
Message: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
This is what my connection string looks like:
@"Integrated Security=SSPI;Packet Size=4096;Data Source=""EC-BJACOB"";Initial Catalog=BenefitSelectDBSQL;Provider=""SQLOLEDB"";Workstation ID=""EC-BJACOB"";Use Encryption for Data=False";
I'm new to C# and especially new to database programming, so I don't really know where to start to address this issue.
Thanks for any help you can give!
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|
|
This is what the connection string really looks like:
@"Integrated Security=SSPI; Packet Size=4096;Data Source=""DB-NGIVENS"";Initial Catalog=BenefitSelectDBSQL; Provider=""SQLOLEDB"";Workstation ID=""DB-NGIVENS"";Use Encryption for Data=False";
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|
|
You are using Integrated Security here. If this is a windows application, it's picking up your credentials from your network login; if it's a web application, it's picking up ASPNET's credential.
Make sure you [or ASPNET] have login rights to the database.
Personally when I'm stuck, I try 2 things: (1) I try going in to Query Analyzer and checking my integrated security credentials by logging in to the server in question; and (2) I try using a User Name and Password in my connection string to see if that makes any difference, instead of Integrated Security. You might have to be in mixed mode for that, though. More on that if you want it.
I hope that's a start for you.
|
|
|
|
|
That is a start, and I appreciate the reply, but the truth is I'm not really sure what Integrated Security is, or how I ended up using it. It is a windows application (not a web application).
I don't actually have a network login, that I know of. On the test computer I don't login to the network. I get onto the WLAN because I set up the wep key, and they haven't seperated the LAN from the WLAN, so I can get into the printers, server, etc. from there.
I'd be happy to change it to mixed mode and send a password, but I'm not sure how to do do that. I've also never used the Query Analyzer, but I'll try that out tomorrow.
So any further information you can give me will be MOST helpful.
Thanks again for the reply!
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|
|
OK so I'm going to attempt to answer what I can, and I would welcome any rebuttals from anyone with conflicting information. I am pretty much a newbie, and all I can offer are suggestions to get you started. So forgive me if I get too basic.
It looks like your first job is to figure out what security you need to connect to your SQL Server remotely, forgetting your code. Just figuring out what credentials you need, and in what context, will help you figure out what to put in your code.
First of all, "Integrated Security" is to say "Windows Authentication", or, taking the credentials of whomever is logged in, and passing those credentials automatically. So if I'm logged in locally to MYCOMPUTER, my credentials being passed would be UserName: MYCOMPUTER\SueH Password:SuesPassword. If I'm logged into the domain MyDomain, my credentials being passed would be MyDomain\SueH Password:SuesPassword.
SQL Server Authentication is the other choice, which is to say, give me a User Name and Password. You have to set up this name and password in SQL Server, through Enterprise Manager.
To get to Enterprise Manager, select All Programs -> Microsoft SQL Server -> Enterprise Manager. This should be installed on the machine where your database resides.
When you bring up Enterprise Manager, you will want to expand the database in question. Drill through until you see the folder for Security, and check out Logins. That's where you want to put your security. If you just want to pass in a name and password through SQL Server auth, just type in Name for the username; however if you want a domain account to have access, don't forget to type in the username as Domain\User such as MyDomain\SueH.
Next, if you want to enable your SQL Server to accept SQL Server authentication and not just integrated security, right-click on the database in question, and select Properties. Go to the Security tab, and choose "SQL Server and Windows" instead of "Windows Only". CAUTION: If you are not the database administrator, I would highly recommend you consult with them. Screwing around with security can leave holes all over the place if you're not careful.
For each login you want to give access to, you can right-click on the login and select Properties, and it will allow you to "lock down" each login to the level of security you want the application to use. With a little investigation, you can lock down an account to only the databases, tables, views, and sprocs you want, and even read-only I think.
Once you are a little more familiar with the login process, you can look at how best to integrate your code with it. Try logging in from Query Analyzer (another tool in the SQL Server folder) using different methods, and see which accounts have which types of access.
Good luck, hope any of this helps.
Sue
|
|
|
|
|
Not only do I not have a "Microsoft SQL Server" folder anywhere in my programs, when I drill through "C:\Program Files\Microsoft SQL Server" I can't find the enterprise manager there either. All I can find that is any use at all is sqlmangr.exe which is just the SQL Server Service Manager (it only has drop down boxes for server and service and a play, pause and stop button).
Is there any possibility that I don't have MS SQL Enterprise Manager installed? If you can let me know what the .exe file is, I can search for it.
Thanks.
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|
|
Well, do you have a C:\Program Files\Microsoft SQL Server\80\Tools\Binn folder? If you do, look for isqlw.exe (Query Analyzer) and SQL Server Enterprise Manager.MSC (Enterprise Manager). Ent Mgr is a "Snap-in" to the MMC Console (like if you go to "Computer Management" from the Administrative Tools menu).
If not, you may have the free version of only the engine. Could you do this - go locally where you know it works and "ask" for the version: look at this web page http://www.ssw.com.au/SSW/KB/KB.aspx?KBID=Q746022[^] or this page http://www.sqlteam.com/item.asp?ItemID=8318[^]. You simply have to send SELECT @@VERSION and it will return you the version, then you can match up the results.
In any case, if you're using Visual Studio 2003 (or 2002 I think) you can go up to the View menu and choose "Server Explorer". Choose the local server (where the database is) and expand the server until you see SQL Servers. Expand that and you should find your database. To my knowledge, you cannot change any logins from here, but at least you can look at the data. You can add tables, stored procedures, and views, and the Visual Studio IDE will "help" you create the sql for it by giving you a template.
Anyway, depending on what version you have, that will determine how you set up your logins. I'm really getting into territory here I don't know well, but see what you can find out and we'll go from there. My boss wrote the book on SQL server - quite literally, wrote a book - so if I don't know I can find out.
|
|
|
|
|
Thanks so much for your help Susan.
I do ahve the folder C:\Program Files\Microsoft SQL Server\80\Tools\Bin, but I don't have either isqlw.exe or SQL Server Enterprise Manager.MSC. I remember doing something with the MMC Console before, but I'm not sure how to get there now (no problem getting to "Computer Management" - it's faster to just right-click on "My Computer" and select "Manage", by the way).
I also don't know what you mean by going locally to where I know it works and then asking for the version. The only way that I've gotten it to work at all is by writing code in my application that opens up a connection and sends the SQL commands at run-time. I tried modifying to send the SQL Command "SELECT @@VERSION" but it's not working (neither executescalar() nor executenonquery() worked).
On the bright side, I was able to use the Visual Studio 2003 Server Explorer to find my database - just not sure what to do with it once I find it.
So... any other ideas on how to find out the version AND/OR download the query analyzer and enterprise manager?
Thanks again for your help so far!
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|
|
This web site http://www.aspfaq.com/show.asp?id=2160[^] seems to indicate that if you have the free version of SQL Server engine, MSDE (I think that's something like Microsoft SQL Desktop Engine) you should have the osql command line tool. That's like query analyzer without the graphical interface.
If that's the case (it would be in the same BINN folder I wrote about last post) then you can set up your logins using osql/SQL commands if you have to.
|
|
|
|
|
OK, OSQL.exe works, but I can't log in to ther server. Since it's Integrated Security I would have thought I dont' need username/password, but the command prompt wants me to enter them.
Ideas?
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|
|
Of course, if you don't log in with a network account, there is always the question to investigate: can you get to ANY file on the server in question, from your laptop? I'm not sure how your setup is - well - set up, such that you are accessing things remotely.
|
|
|
|
|
You may be a newbie, but you definately know a whole lot more than I do. Thanks so much for your help. I'm going to try out all the things that you've mentioned so far.
I can get to the server from my laptop, but it asks me for a login to get on. I have to supply domain name\user name and password before I get access.
Also, just so you know, the database one I've assembled from scratch and is located on my personal workstation, so I don't have to talk to an admin. Besides... I work in a small company. Our "network admin" is also our accountant.
I'll let you know how it goes!
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|
|