|
Am retrieving data from my databese engine to read the data, but encountering an error at dr.Read(), con.close().
public string constring = @" ";
SqlConnection con = new SqlConnection(constring);
SqlCommand cmd = new SqlCommand("select * from emp",con);
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
con.Close();
"Invalid token '(' in class, struct, or interface member declaration", what could be the reason for this?
-- modified at 18:59 Friday 9th February, 2007
|
|
|
|
|
This should be posted in the SQL Database section.
_____________________________________________________________________
Our developers never release
code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
Visit Me at GISDevCafe
|
|
|
|
|
sreecahitu wrote: new SqlConnection(" ");
How is that a connection string ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I indicated the connection string correctly with source,user name and pwd, but i didnt mention here.
string constring=@"source, user="",password="" ";
SQLConnection con=new SqlConnection("cosnstring");
|
|
|
|
|
OK, I think we've found the problem.
sreecahitu wrote: string constring=@"source, user="",password="" ";
When you use @, you need two " to make *one* quote. So, it's user=""name""
sreecahitu wrote: SQLConnection con=new SqlConnection("cosnstring");
Because you put it in quotes, you're passing in the value cosnstring, instead of the value of the variable with that name.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
If i write as follows,
string constring=@"source, user=,password= ";
SQLConnection con=new SqlConnection(cosnstring);
still am getting an error.
|
|
|
|
|
This may seem like a stupid question, but which database engine are you using? SQL Server, MySQL, Access, Oracle, ... ?
You can find the correct format for your connection string at http://www.connectionstrings.com[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
That doesn't look like a valid connection string to me.
Did you post the actual code in the first instance ? Or did you change it in other ways ? This does not account for your actual error, really, which makes no sense to me, right now.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
ya, thank you all,
i modified wrongly.
I got the problem, the problem is with declaring the declaration of string.
|
|
|
|
|
Just remove the @ character
Dabsukol
|
|
|
|
|
I have problem I use Northwind database to build some prototype application in C#.
Thing is when I set on Orders to display me EployeeID and CustomerID as listbox, I can select data source so they show only Name instead of ID, but Value is indeed ID of those 2.
However when I do this Datanavigator have no effect on those 2?
Wonder why since doing same thign on column in data grid work just fine.
Any idea?
Not exactly ado question I guess so I hope it's right room...
|
|
|
|
|
hello guys
i want to use my gprs modem /wirelsess card attatched on my pcmci throug my c# application,
means i want send and receive sms based on my business logic through this application ,,
any idea where to start ,, have any one done that before ,,
any help will be highly appreciated ,,
thanks in advance
hello
|
|
|
|
|
AFAIK you can talk to it like a normal modem.
Did you try Google, it turned up this[^] as my first result for my first search.
|
|
|
|
|
Hi!
I want to draw some semi-transparent rectangles over special regions of a richtextbox.
So I hook up in the DefWndProc of an inherited RichTextBox class.
This looks like this:
protected override void DefWndProc(ref Message m)
{
base.DefWndProc (ref m);
switch (m.Msg)
{
case WM_PAINT:
MyPaint();
break;
}
}
In MyPaint() I draw onto the richtextbox with a rectangle. This all works fine.
But when I start clicking into the richtextbox my rectangles becomes more and more "solid" (cumulating alpha channels I suppose)... What can I do to fix that? If I minimize the form and maximize it again, everything's fine again.
It really seems to me, that the richtextbox fires WM_PAINT messages too often without clearing the screen...
Clearing the richtextbox with Graphics.clear() or UserPaint is not a real option for me... I do not want to paint everything by myself. I also tried to capture the bitmap of this part of the screen and draw that (by clearing the screen after capturing the image). But I end up with the same problem.
I also tried to use the captured image to check if pixels are white or have some other color. Due to some (unknown) reason, that did not work out (though I could save that bitmap and it seems to show the right portion of the screen (and I was looking at the right pixels)
But I hope that there's an easier solution.
Cheers and thx for all help!
|
|
|
|
|
Hi,
While searching for the same functionality, I found your message. Please respond, if you find solution to draw semi-transparent rectangles in RichTextbox. Thanks in advance.
|
|
|
|
|
Hi there!
This is quite old If I remember correctly, I did use the back color drawing of the richttextbox for a while. But when I realized that things became too slow and all my colored boxes in the rtf where flickering (I needed to repaint boxes where the user dragged the mouse over) I finally made up a richtextbox myself. In the end this was the best decision for me and even did not took too much time (maybe because I did soo many different things with the rtf that writing your own was easy then). With my own kind of rtf I finally could draw everything the way I wanted (using GDI+) and it now works fine and fast (much faster than the rtf) with no flickering at all (even if I heavily use boxes and alike).
I am sorry but I cannot post any code here, as this rtf was part of a business work and I sold it, thus this wouldn't be okay to do so. And the code for this is also quite specific and it is much code.
But if you want to do something special with rtfs think about doing it all yourself. As I said, it took me less time doing it myself, than trying to get the rtf to do what I wanted. (Of course this depends on what you want to do with the rtf).
Hope this will help you a bit.
Cheers
|
|
|
|
|
i know this is a c# forum but couldn't find one vb. if i get a sample how to it in C# no prob i can convert it
Default using vb.net to post to a website
i want to post a string to a website can anyone show me or point me to example of how you would use vb.net to post a string to a website and accept the response sent back from post / request to the site?
|
|
|
|
|
keroed_edmond wrote: i know this is a c# forum but couldn't find one vb.
The Code Project discussion boards - Visual Basic / VB.NET[^]
Regarding your actual question, the HttpWebRequest class may what you're looking for.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
|
I can think of one thing right away that you should check.
i assume that this button you want to click, that isn't doing anything even though you have an action written for it, is not "wired" to the event.
Here, select the button in the gui designer and go to its properties. then click the little lightning bolt in the propertygrid and goto its events... Now... if you see an empty box to the right of the "Click" event... then my guess is right and the event is not wired. Click inside that empty box, and a combobox-dropdown button should appear...hit it and, select "button1_Click" from the list. now it should work
sometimes this happens when you paste stuff from other forms or something...
|
|
|
|
|
No, the event of Click was already on button1_Click it didn't work.
SnaidiS(Semion)
|
|
|
|
|
hmm...then it's probably a logic bug in your code or that control or somewhere between.
did you try setting a breakpoint and stepping into it?
I'm not sure if you know this or not. you click in the margin to the left of this line "private void button1_Click(" and get a little red circle to appear...the breakpoint... then do debug -> start. and when you click the button, the code should run to that line.. then do debug -> "step into" and line after line see what gets executed and what doesn't.
if you cant figure it out...you can send me you test project and i can try to find the problem. i know you posted the code, but i'm a bit lazy to recreate your project...and maybe theirs something not in the code thats messing it up :P
|
|
|
|
|
I tried to debug it and when I click the button it makes the function but I dont see the results on screan..
OK, I'll upload the project.
Here is the project.
http://fileho.com/download/e95cc0167872/Graphics.rar.html[^]
and listen If you have problem with the Graph Control so the dll is on the folder.
Thanks
SnaidiS(Semion)
|
|
|
|
|
my email is the username i use here @gmail... :P
|
|
|
|
|