|
Kwagga wrote: I want to put a sql server connection together but don;t know how.
Here[^]
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
i got some error while connecting the server database(sqlserver in DATABASE sever) ....System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
when i put the code in server
but i can connect it in client side(using .net 2005 development platform)
i just use the code
SqlConnection con = new SqlConnection("Data Source=server ip;initial catalog=database name;uid=userid;pwd=password");
sqlCommand cmd = new SqlCommand();
cmd.CommandText = "select * from StLogin";
cmd.Connection = con;
SqlDataReader dr;
con.Open();
dr = cmd.ExecuteReader();
while (dr.Read() != false)
{
DropDownList1.Items.Add(dr[1].ToString());
}
|
|
|
|
|
I'm sick of answering this one for people. Here[^], help yourself.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
imatetvm wrote: Urjent
The subject should contain a useful description of the question.
However urgent you may feel that the question is, it's never urgent enough to mention in the subject, or you would not post the question in a forum instead of paying someone for support.
imatetvm wrote: i got some error while connecting the server database
Have you considered the possible explanation that was given to you in the error message already?
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Hello
within my application i have a richtextbox, when i trying to print someting it doesn't work.
Bullets are not shown on the printpreview hereby the code
// OnBeginPrint
private void OnBeginPrint(object sender,
System.Drawing.Printing.PrintEventArgs e)
{
char[] param = { '\n' };
if (printDialog1.PrinterSettings.PrintRange == PrintRange.Selection)
{
lines = richTextBox1.SelectedText.Split(param);
}
else
{
lines = richTextBox1.Text.Split(param);
}
int i = 0;
char[] trimParam = { '\r' };
foreach (string s in lines)
{
lines[i++] = s.TrimEnd(trimParam);
}
}
// OnPrintPage
private void OnPrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
int x = e.MarginBounds.Left;
int y = e.MarginBounds.Top;
Brush brush = new SolidBrush(richTextBox1.ForeColor);
while (linesPrinted < lines.Length)
{
e.Graphics.DrawString(lines[linesPrinted++],
richTextBox1.Font, brush, x, y);
y += 15;
if (y >= e.MarginBounds.Bottom)
{
e.HasMorePages = true;
return;
}
else
e.HasMorePages = false;
}
}
I hope someone canhelp me
thanks anyway
-- modified at 8:41 Thursday 8th November, 2007
Greetzzz
Rudy
|
|
|
|
|
Hi,
first of all I don't have any experience printing RTB content. But looking at your code
I can see you only take its (Selected)Text, i.e. the string representing its content,
ignoring all formatting (font selection, colors, bullets, ...). This does not look right.
May I suggest you search CP (or Google) for "RichTextBox print".
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I did not find any solution thats work properly
Greetzzz
Rudy
|
|
|
|
|
That is not very informative, you don't tell us what you did and tried, and what parts
did or did not work.
Did you search CodeProject articles? Here is one for starters[^].
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Ok problem solved, i fond the code on msdn
Thanks anayway
Greetzzz
Rudy
|
|
|
|
|
If we get a resultset from a stored procedure in sql server
How to get that resultset in dataset in C#
Thanks in advance
Gaurav
|
|
|
|
|
You can use SqlDataAdapter class to retrieve data into dataset using stored procedures
|
|
|
|
|
Use a SQLDataAdapter object, and use Fill() method to fill the dataset.
|
|
|
|
|
Hi,
If i have a 100*100 array of values (say 0 is black and 255 white), how do I display it as in image on a picture box ?
thanks,
Assi.
|
|
|
|
|
Create a Bitmap object and use the SetPixel method to set the color of each pixel.
If you need extra speed, you can use the LockBits and UnlockBits methods to access the pixel data more directly.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Append a bitmap header to a memory stream and then copy your array to the stream. Then create a new bitmap using the stream constructor. That will be the fastest way. See wikipedia for the format definition.
http://en.wikipedia.org/wiki/Windows_bitmap
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
I am currently using the HTTPWebRequest class. I need to add the following to the request line:
POST /Search HTTP/1.1
It is simple to get 'POST HTTP/1.1' but i am having difficulty adding the additional string.
I cannot seem to get the '/Search' inserted in the request line. I understand HTTP 1.1 and the VERBS allowed as part of a request.
The 'method' property is used to set the VERB. Adding anything other than a single string throws a null reference exception. I have seen extra information appended to the method many times in the past so not too sure why this is so problematic.
I initially thought of overriding the HTTPWebRequest but as it is created from calling Create() on the WebRequest, this doesn't appear possible.
Thanks in advance.
Carl
|
|
|
|
|
As far as I know, you only have access to the Headers collection on the HttpWebRequest. You will probably need to write your own class for this functionality.
Luckily, you can use this post as a basis for getting that done. http://www.thescripts.com/forum/thread343158.html[^]
Good luck.
|
|
|
|
|
Hi Mike,
thanks for the post. I did something very similar already as a back up to the problem, using the TCPClient and NetworkStream. Created an additional HttpProtocol class and added all the members that might be needed. provided an override of ToString with booleans against each of the properties as to whether to include them in the ToString. Feels so cludgy though. plus it's a real pain interrogating the response headers and content. as it just comes back as a byte array.
still think there must be a better way.
thanks.
Carl
|
|
|
|
|
I want to handel an event like combobox_textchange or selected index change in a gridview column(combobox column) and text_textchange in anther grid column(text column).
merwa
|
|
|
|
|
Hi!
I have 2 buttons in my form and array objects of picturebox.
when button1 is clicked. One Picture box is created. Then i move it (picturebox1)to a desire place.
I clicked button1 again and the second picturebox (picturebox2) is also created and i move it to a place that i want.
The problem is when i click the picturebox1 after the picturebox2 is created and moved. The picturebox2 moves automatically and disappears quickly. I don't know why and how to fix it.
Best regard!
|
|
|
|
|
We know why - there's bugs in your code. Can't really offer much more help than that, without seeing the code.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Here is my code:
public partial class Form1 : Form
{
private Point old;
private bool isDragging = false;
private PictureBox[] myPic;
private int count = 0;
public Form1()
{
InitializeComponent();
begin();
}
public void begin()
{
myPic = new PictureBox[5];
}
private void button1_Click(object sender, EventArgs e)
{
myPic[count] = new PictureBox();
myPic[count].Image =System.Drawing.Image.FromFile("house.gif");
this.Controls.Add(myPic[count]);
myPic[count].MouseDown += new MouseEventHandler(Form1_MouseDown);
myPic[count].MouseMove += new MouseEventHandler(Form1_MouseMove);
myPic[count].MouseUp += new MouseEventHandler(Form1_MouseUp);
count++;
}
void Form1_MouseUp(object sender, MouseEventArgs e)
{
isDragging = false;
}
void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (isDragging)
{
myPic[count-1].Left = myPic[count-1].Left + (e.X - old.X);
myPic[count-1].Top = myPic[count-1].Top + (e.Y - old.Y);
}
}
void Form1_MouseDown(object sender, MouseEventArgs e)
{
old.X = e.X;
old.Y = e.Y;
isDragging = true;
}
}
|
|
|
|
|
You should use a list, this will break after 5 items.
If you debug, is count 0 or 1 the second time ? It looks like it should be 1, but it seems likely it's not.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I can't debug because when i just move mouse on the picturebox, click event is not excuted but the mouse move event is excuted firstly. So the mouse move event is always happened while i can't reach the mouse click event.
By the way, count is always increased after clicking button1.
Please tell me how to correct the problem.
Thanks for replying.
-- modified at 5:45 Thursday 8th November, 2007
|
|
|
|
|
Okay, first off, don't use myPic[count-1] to access the control you want tp drag, you have the object 'sender' which is the control that was actually clicked, so if you use:
PictureBox temp = sender as PictureBox;
temp.Location.X = ...
temp.Location.Y =
...
Then you will always drag the picture box that you actually clicked.
Infact, if you add another picturebox like, currentPicBox or something and use that to find out which picbox was clicked. So, in the MouseDown event:
currentPicBox = sender as PictureBox;
and in the mouse move event:
currentPicBox.Location.X
...
-- modified at 6:09 Thursday 8th November, 2007
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|