|
Where did you get the error message? You couldn't have gotten it in the code you are showing.
You catch any exception that occurs and ignore it, so you'll never know if the connection was successful or not, or the reason if it wasn't. If you catch the exception, you have to handle it, or you will end up just as you are now, fumbling in darkness without a clue to what went wrong.
---
b { font-weight: normal; }
|
|
|
|
|
The message comes with the dialog with 3 buttons like "Detail, continue, Quit" , I got it from checking the detail button!
Alan Shen
MCAD for .NET Version
^~^~^~^~^~^~^~^~^~^~^
Great idea is the beginging of success!
|
|
|
|
|
Ley me get this straight. You're trying to open this connection to the database and leave it open for the life of the form? Bad practice.
In your Detail button code, open a connection to the database, do your work, then close it.
But, it's hard to tell because you haven't posted any of the code in your Detail button handler.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok, good.
Now also read the second paragraph of my previous post.
---
b { font-weight: normal; }
|
|
|
|
|
i solve the problem, i think it is because of the release optimise. since the code works for debug version. anyway, i change the code structure, everything is fine now!:
Alan Shen
MCAD for .NET Version
^~^~^~^~^~^~^~^~^~^~^
Great idea is the beginging of success!
|
|
|
|
|
Hello All,
I made a Com+ component and i used it in the client server way but my server in subnet and the clients in another subnet and there is a firewall in the network. after i search on the internet i found that the Com+ and DTC use the Netbios. the problem is the microsoft still use Netbios to comunicate to the server and client.
this is the problem. Please can any one help me to solve this problem.
thanks for your time.
Best regards,
Hoho
|
|
|
|
|
Hi to everybody,
I´m trying to connect with a database in Sybase, if I connect in local no problem, the problem is when I´m try to connect from other computer and the
program C# give me this error:
Message "Invalid connection string. Error parsing connection parameter string\r\nNombre del parámetro: connectionString" string
This is my code:
using iAnywhere.Data.AsaClient;
private AsaConnection _conn;
private void btnConnect_Click(object sender, System.EventArgs e){
string connStr = "Host=192.30.3.83;Port=2638;User ID=DBA;Password=SQL;Database Name=prisma1";
try{
_conn = new AsaConnection(connStr );
_conn.Open();
}
catch( AsaException ex ){
MessageBox.Show(ex.Message,"Failed to connect");
}
}
As well I have tried with this string:
string connStr = "server=192.30.3.83;user id=DBA; password=SQL; database=mysql; pooling=false";
string connStr "=192.30.3.83;Port=2638;Database=prisma1;UID=DBA;PWD=SQL";
//string connStr = "Host=192.30.3.83;Port=2638;UID='dba';PWD='sql';Database='prisma1';Pooling=false;";
//string connStr = "Data Source = prisma1;UID=DBA;PWD=SQL;";
//string connStr = "Data Source = prisma1;UID=DBA;PWD=SQL;";
//string connStr = "Network Address=192.30.3.83;Port=2638;UID=DBA;PWD=SQL;DatabaseName=prisma1;";
//string connStr = "Data Source=prisma1;Host=192.30.3.83;PWD=SQL;Port=2638;UID=DBA;DatabaseName=prisma1;";
But C# always return the same error.
Any help ??????? Any code ???????
Thanks in advance.
Coloso
|
|
|
|
|
From connectionstrings.com[^]:
"Data Source='myASEserver';Port=5000;Database='myDBname';UID='username';PWD='password';"
---
b { font-weight: normal; }
|
|
|
|
|
Hello,
I was wondering if you can give me some advice as to how I can see a webcam installed in a computer, from another one. I've been looking into Directshow, WIA, and they both seem to work in the same PC, but I was wondering how I could see the video live from another computer. Any suggestions?
I was thinking about sending information through a web service (Intranet) but I'm not sure yet about I can possibly obtain the memory stream or something from directShow or WIA.
Apologies but I don't know where would be the right place to ask this. So I figured C# could be a possible choice.
Are there any articles you can suggest?
daniero
|
|
|
|
|
You could use the DirectShow.NET[^] library and use that to publish your video. However, if you want something close to "real time," you may want to think about an architecture different than a Web service.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hi All,
I am having a function which can be called from different independent threads
simultaneously.Inside this i am having a hashtable.what each thread will do that it will check whether the hashtable contains a particular key if not then it will make an entry in the hashtable with that key or if it exists it will simply use the value corresponding to that particular key.what i want that the access to the function should be on first come first serve basis.so if a thread is already waiting on the function the current thread after completing processing should leave it (should enter in succession only if there is not any waiting thread), and no thread should be kept waiting for infinite.so entry into the function should be related to time of waiting in short i want the impementation to be a queue like.is using lock(object) will be suffice for the task or i have to use something else. and also if you can tell me how this lock statement functions.whether it will cause the other statement to wait or simply not allow the other threads to access it and throw some error.Thanks in Advance.
Rakesh
|
|
|
|
|
From the documentation.[lock ] marks a statement block as a critical section by obtaining the mutual-exclusion lock for a given object, executing a statement, and then releasing the lock However, you do not have the guarantee that it acts like a queue, only mutual exclusion on a thread-level basis. If you have an infinite condition in your lock block, then all other threads will wait forever.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
hi,
i have 2 froms: From1 & From2
Form1 have 2 buttons - 1st button open Form2, second button must close
opened Form2.
i opened Form2 by click button :
private void button1_Click(object sender, EventArgs e)
{
Form2 frm2 = new Form2();
frm2.Show();
}
how can i close this FORM2 by click on Button2?
thx for help
Athlon 64 3500+, Gigabyte GA-K8NXP-9, 2x512 DDR400 Kingston, Inno3d 6200 PCIe, SS2 B2C2 v2.6, HDD := 450gb, Genius 56k int, NEC DVD-RW и мать его Суньмастер 550.
|
|
|
|
|
To close Form2 , you need a reference to it. And easy solution would be to include a private variable in Form1 to "remember" the Form2 instance.
class Form1 : Form
{
private Form2 frm2;
public Form1() { frm2 = new Form2(); }
private void button1_Click(object sender, EventArgs e)
{
frm2.Show();
}
private void button2_Click(object sender, EventArgs e)
{
frm2.Hide();
}
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
ok i try this code but my visual express 2005 say^
Error 2 Invalid token '{' in class, struct, or interface member declaration C:\Documents and Settings\maiden\My Documents\Visual Studio 2005\Projects\nebrowser\nebrowser\Form1.cs 18 9 nebrowser
Error 3 Class, struct, or interface method must have a return type C:\Documents and Settings\maiden\My Documents\Visual Studio 2005\Projects\nebrowser\nebrowser\Form1.cs 19 13 nebrowser
Error 4 Invalid token '=' in class, struct, or interface member declaration C:\Documents and Settings\maiden\My Documents\Visual Studio 2005\Projects\nebrowser\nebrowser\Form1.cs 20 41 nebrowser
Error 5 Invalid token '=' in class, struct, or interface member declaration C:\Documents and Settings\maiden\My Documents\Visual Studio 2005\Projects\nebrowser\nebrowser\Form1.cs 21 56 nebrowser
Error 6 Invalid token '=' in class, struct, or interface member declaration C:\Documents and Settings\maiden\My Documents\Visual Studio 2005\Projects\nebrowser\nebrowser\Form1.cs 22 52 nebrowser
Error 7 Expected class, delegate, enum, interface, or struct C:\Documents and Settings\maiden\My Documents\Visual Studio 2005\Projects\nebrowser\nebrowser\Form1.cs 28 17 nebrowser
Error 8 Expected class, delegate, enum, interface, or struct C:\Documents and Settings\maiden\My Documents\Visual Studio 2005\Projects\nebrowser\nebrowser\Form1.cs 33 17 nebrowser
Error 9 Expected class, delegate, enum, interface, or struct C:\Documents and Settings\maiden\My Documents\Visual Studio 2005\Projects\nebrowser\nebrowser\Form1.cs 39 17 nebrowser
Error 10 Expected class, delegate, enum, interface, or struct C:\Documents and Settings\maiden\My Documents\Visual Studio 2005\Projects\nebrowser\nebrowser\Form1.cs 44 17 nebrowser
Error 11 Expected class, delegate, enum, interface, or struct C:\Documents and Settings\maiden\My Documents\Visual Studio 2005\Projects\nebrowser\nebrowser\Form1.cs 50 17 nebrowser
Error 12 Expected class, delegate, enum, interface, or struct C:\Documents and Settings\maiden\My Documents\Visual Studio 2005\Projects\nebrowser\nebrowser\Form1.cs 55 16 nebrowser
Error 13 Expected class, delegate, enum, interface, or struct C:\Documents and Settings\maiden\My Documents\Visual Studio 2005\Projects\nebrowser\nebrowser\Form1.cs 70 17 nebrowser
Error 14 Type or namespace definition, or end-of-file expected C:\Documents and Settings\maiden\My Documents\Visual Studio 2005\Projects\nebrowser\nebrowser\Form1.cs 81 5 nebrowser
========================================
here my app^
[code]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form2 frm2;
public Form1() { frm2 = new Form2(); }
{
InitializeComponent();
webBrowser1.AllowNavigation = true;
webBrowser1.IsWebBrowserContextMenuEnabled = true;
webBrowser1.WebBrowserShortcutsEnabled = true;
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
}
private string browserURL
{
get { return browserURL.Trim(); }
set { browserURL = value; }
}
// private void browserGoButton_Click(object sender, EventArgs e)
private void browserGoButton3_Click(object sender, EventArgs e)
{
Navigate();
}
private void Navigate()
{
}
private void toolStripTextBox1_Click(object sender, EventArgs e)
{
}
public void button1_Click(object sender, EventArgs e)
{
//Form2 frm2 = new Form2();
frm2.Show();
}
public void button2_Click(object sender, EventArgs e)
{
frm2.Hide();
}
}
}
[/code]
Athlon 64 3500+, Gigabyte GA-K8NXP-9, 2x512 DDR400 Kingston, Inno3d 6200 PCIe, SS2 B2C2 v2.6, HDD := 450gb, Genius 56k int, NEC DVD-RW и мать его Суньмастер 550.
-- modified at 11:26 Tuesday 10th January, 2006
|
|
|
|
|
You have too many sets of brackets in your constructor
public Form1() <code>{</code> frm2 = new Form2(); <code>}</code>
{
InitializeComponent();
webBrowser1.AllowNavigation = true;
webBrowser1.IsWebBrowserContextMenuEnabled = true;
webBrowser1.WebBrowserShortcutsEnabled = true;
}
public Form1()
{
frm2 = new Form2();
InitializeComponent();
webBrowser1.AllowNavigation = true;
webBrowser1.IsWebBrowserContextMenuEnabled = true;
webBrowser1.WebBrowserShortcutsEnabled = true;
}
If you still get the same mesage it has something to do with where you are placing an '{'
Take a close look at your code
Kev
|
|
|
|
|
You have an extra block on your constructor. Fix it like this.
public Form1() { frm2 = new Form2(); }
{
InitializeComponent();
webBrowser1.AllowNavigation = true;
webBrowser1.IsWebBrowserContextMenuEnabled = true;
webBrowser1.WebBrowserShortcutsEnabled = true;
<span style="background-color:yellow">frm2 = new Form2();</span>
}
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
thaks man all working
Athlon 64 3500+, Gigabyte GA-K8NXP-9, 2x512 DDR400 Kingston, Inno3d 6200 PCIe, SS2 B2C2 v2.6, HDD := 450gb, Genius 56k int, NEC DVD-RW и мать его Суньмастер 550.
|
|
|
|
|
My pleasure. Happy coding!
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I have tried finding my answer here and MSDN and am either searching for the wrong critieria or the answer is right in front of me. I am rather new to ADO.net and believe my problem relates to being completely comfortable with with ADO 1.5. I prefer runtime data access over design time controls.
I am trying to do a simple add record to an Access 2000 database that has four fields. The ID field which is autonumber, the FirstName field, LastName field and a Deleted field which is Yes\No (default = 0). When I try the INSERT command I get an error about the insert command being invalid. Here is a code snippet from my code.
String sDBConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data" +
"Source=D:\\source\\C# Proj\\Test\\AppData.mdb;" +
"Mode=ReadWrite|Share Deny None;Jet OLEDB:Engine " +
"Type=5;Jet OLEDB:Database Locking Mode=1;";
OleDbConnection dbAddConn = new OleDbConnection(sDBConnect);
String sQuery = "INSERT INTO Contact (FirstName,LastName,Delete)
VALUES (\"Papa\",\"Bear\",0)";
OleDbCommand dbCmd = new OleDbCommand(sQuery, dbAddConn);;
dbAddConn.Open();
try
{
dbCmd.ExecuteNonQuery();
}
catch(Exception e)
{
MessageBox.Show(e.ToString(),"Data Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
dbAddConn.Close();
Error happens and ExecuteNonQuery(). Also, what is the easiest way to get the added id number. If there is an easier way to achieve what I am doing, I'd love to here it. Currently I like the old ADO 1.5, I had no problems with it.
Thanks for your assistance.
Leo T. Smith
|
|
|
|
|
Use apostrophes instead of quotes around the strings in the query.
Delete is a reserved word. Rename the field, or if that is not possible, put brackets [] around the name in the query.
---
b { font-weight: normal; }
|
|
|
|
|
hi guys,
need help with this one.. im building a license monitoring application. and part of the system is the module in which the program kills/blocks a certain application from running based on the returned info from the database (license information). so if the company has 5 licenses for a specific app, then 5 should be the max number of concurrent usage, though it can be installed on more than 5 pcs.
so my question is, is it possible for my app to be embedded in the OS, so that i can control the applications being ran based on my license server.. or is there any other way to do it..
i need comments/suggestions/any wild ideas guys.. thnx in advance...
|
|
|
|
|
I think Sony has a nice little rootkit that does this.....
But seriously, if the application is a .NET app, you could make a license provider dll that would talk to the database and determine if it could launch or not. If the main app is a Win32 one, ou could write a small wrapper exe to do the checking that then runs the normal app. One thing to think about when ou are building this type of system is the need for an admin to be able to add a license quickly. Sometimes purchasing a license or a block of licenses could be a slightly slower process. If you had a good way to allow another copy to run (and keep track of that) then users will not feel trapped by their own purchasing dept.
Steve Maier, MCSD MCAD
|
|
|
|
|
thanks for the reply Steve..
yes my application is a c# .net application. what i have now are codes for viewing all the running processes and killing a running process. im new in network programming, i also havnt explored much of the .net class library that's why im having difficulties in trying to implement this.
can i ask you some questions? what is that license provider dll? and what about that wrapper exe? can i put that in my client pcs and embed it in the OS? so that when the client PCs boot, it already has that client application agent running, thus enabling the communication between my server and its clients. And from the server, i can get info about that specific client.tnx
|
|
|
|
|
Sounds like a VERY convoluted solution to a licensing issue.
Why couldn't you just create a license server on a machine and have the client software just ask for and checkout a license? When the client is done, the license is checked back in to the database. The licenses would have to be checked out on a leased basis so you don't end up with permanently checked licenses. The clients would have to renew their lease every so often in order to keep working.
Forget trying to "kill process" and all that crap. It's an unsupportable solution...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|