|
Hi Guys,
I wish for the first line of my DataGridView to be a search line, meaning that all the other rows are filtered according to the value the user inserts to the corresponding column top cell. For example, if the user enters "a*" at the first row's first cell, only rows with the first cell beginning with the letter "a" are shown. Of course, when sorting, this line should be disregarded.
Any suggestions of how to implement such functionality?
Thanks!
Eyal.
|
|
|
|
|
Hi,
I try to develop a csharp smart device application.I want to try the RDA method to connect to the database .mdf located in my collegue'sPC
My code is like that:
using System;
using System.Linq;
using System.Data.SqlServerCe;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace ModeDifféré
{
public partial class Form6 : Form
{
public Form6()
{
InitializeComponent();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void Form6_Load(object sender, EventArgs e)
{
string sConnection = "Data Source=Bacem-PC;User ID=sa;Password=sa;Initial Catalog=GMAO;Persist Security Info=false;";
string sSQL = "SELECT Nbt FROM 4BT; ";
SqlConnection conn = new SqlConnection(sConnection);
SqlCommand comm = new SqlCommand(sSQL, conn);
SqlDataReader dr = null;
try
{
comm.Connection.Open();
dr = comm.ExecuteReader();
while (dr.Read())
comboBox1.Items.Add(dr[0]);
}
catch (SqlException ex)
{
MessageBox.Show("connexion impossible");
MessageBox.Show(ex.Message);
return;
}
dr.Close();
comm.Connection.Close();
}
}
}
where bacem-PC is my freind'sPC server .He enables remote connexion to his sql server.
When running,this error appears:"specified sql server not found or acces denied"
As a note,this is the same arror that appears when I try locally in my PC
I am really fed up of this annoying error??
URGENT HELP I NEED or i will be a mad person
Thanks
|
|
|
|
|
Funny thing...
Afther a whole thread in which I tried to solve your problem but did not succed you are not demoralised and still prospecting for new solutions...
I like your persistence
You previously said that Visual Studio and Management Studio can connect to your database. If so: add a dataset to your project, and from Visual Studio's datasources (usualy in the left of the screen) drag your tables onto the dataset. This will generate code that connects to your database retrives rows and can update them. (If you don't know how to use this google for Dataset and Strongly Typed Dataset ).
I have no smart signature yet...
|
|
|
|
|
Hi Vlad,
When I have a problem,I don't be happy only if I solve it with all kinds of problems
The problem,Vlad,is that the database I want to connect to is is .mdf database and not .sdf file(used in mobile applications).I want to clarify to u that my project has an object to help the technician communicates successfully with his society'sdatabase.In fact,This society has a .mdf databse created with sql server.The technician will communicate with it with his PDA or his mobile.So that is why I try to connect to my freind'sPC server simulating the process I described above.
If i will add a dataset like u said,I really don't understand to drag tables of .mdf database and use them like .sdf one because in visual studio smart device application doesn't accept only .sdf database files.
I seem sometimes very curious but really I want to demonstrate to all that Marwen can deal well very diffucult problems
Thanks for u collaboration.
|
|
|
|
|
So you are saying that this is a smart device application?
If so, then probably your smart device simulator is not in the same network (if any) with you database server. You might want to check this link[^].
I have no smart signature yet...
|
|
|
|
|
Hi,
Thanks I check the link but almost for the steps I did.But nothing is new
I need really urgent help
Thanks
|
|
|
|
|
Hi Vlad,
Finally I depass the problem of the connexion to server by the DB File's attachment . No exception apperas.Still now the problem of the filling of my combobox .I try with sqldataset instead of the sqlreader like this:
string sConnection = "Data Source=127.0.0.1,1433;Persist Security Info=True;Initial Catalog=GMAO;User ID=sa;Password=sa";
string sSQL = "SELECT com FROM energie; ";
SqlConnection conn = new SqlConnection(sConnection);
SqlCommand comm = new SqlCommand(sSQL, conn);
DataSet ds = new DataSet();
SqlCeDataAdapter da = new SqlCeDataAdapter();
SqlDataReader dr = null;
try
{
comm.Connection.Open();
da.Fill(ds, "SQL Temp Table");
foreach(DataRow d in ds.Tables[0].Rows)
comboBox1.Items.Add(d.ToString());
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
return;
}
dr.Close();
comm.Connection.Close();
}
but nothing is added to my combobox.
Thanks in all cases for u collaboration
I am really so happy
|
|
|
|
|
Hi All,
Im developing a POS application as part of a personal project. The project has a Datagridview which has the items being sold (Quantity,Item Name, Price etc). The Datagridview is on the left of the screen and on the bottom right is my virtual keypad which is basically just a series of Buttons, one for each number. The rest of teh screen is made up of various buttons indicating stock items to sell.
Im having problems getting my head around how to modify a value in the datagrid using the on screen Keyboard. If I click on the button wont focus be taken away from teh Datgridview cell i want to edit?
For example I want the user to click in the Quantity Row on the datgrid and it selects (highlights) what is currently in there (1 For Example) and then if I hit the "2" Button it replaces the 1 with a 2.
Any assistance would be greatly appreciated.
Thanks,
Daniel.
|
|
|
|
|
Hi Daniel,
I didnt have my opportunity to work with on screen keyboard. However I wanted to say that in my laptop whenever I have used my onscreen keyboard using mouse, I have always seen that it does not loose focus. So my opinion is that dont fear about the on screen keyboard and it "loosing focus" thing. You can do things as if you are using the actual keyboad.
My post is not your reply however I wish it helps you.
Thanks,
Arindam D Tewary
|
|
|
|
|
Hi guys,
I create a file .udl to verify my connexion to my sql server database .mdf.The connexion goes well.
I wanna use this in my code without need of a connection string.
Is that possible???,
|
|
|
|
|
Hi,
It is very easy just open the file with Notepad or other text program
Thanks
|
|
|
|
|
Hi guys
I tried to work on "Raw Ethernet Packet Sending" of article by miahrugger i installed the ndis driver
on my network adaptor but running the c# program it can never open the ndis driver .
what should i do?
|
|
|
|
|
If you got the code from an article, then there is a "new message" button at the bottom of that article, which causes an email to be sent to the author. They are then alerted that you wish to speak to them.
Posting this here relies on them "dropping by" and realising it is for them.
I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in.
Apathy Error: Don't bother striking any key.
|
|
|
|
|
Hello World of CodeProject !
How can I open image of PictureBox in windows picture and fax viewer ?
I have searched a lot in google and found bellow code but no use !
Please Help !
Process p = new Process();
p.StartInfo.FileName = PicBoxKala.ImageLocation;
p.EnableRaisingEvents = true;
p.Start();
|
|
|
|
|
It has no exe, Windows Photo Wiever is run from DLL:
ProcessStartInfo psi = new ProcessStartInfo(@"C:\Windows\System32\rundll32.exe", @"shell32.dll,SHCreateLocalServerRunDll {995C996E-D918-4a8c-A302-45719A6F4EA7} -Embedding");
psi.FileName = @"D:\Pictures\133-1920.jpg";
Process.Start(psi);<pre>
<div class="signature"><small>Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.</small></div>
|
|
|
|
|
string Path = txtPicAddress.Text;
Process p = new Process();
p.StartInfo.FileName = "rundll32.exe";
p.StartInfo.Arguments = @"C:\WINDOWS\System32shimgvw.dll,ImageView_Fullscreen " + Path;
p.Start();
|
|
|
|
|
Hi I am writing an email program that will have a login form. when you login with the login form (Form1.cs) it will pass the username and pass word to the gmail program (Form2.cs). This is fine and works but I can not fiqure out how to get the settings.setting form to work in order to make sure that the information is remembered. right now I am using streaam reader and stream writer to read and write the username and password to Visual Studio Project User Options File. It works simply by reading from file on textBox enter and writing to on text box exit but was hoping there was a better way to do this?
Here is the code that i currently use for this
namespace Email_Client
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Email_Client.Form2 Email = new Email_Client.Form2();
Email.User.Text = textBox1.Text.ToString();
Email.Pass.Text = textBox2.Text.ToString();
Email.Show();
this.Hide();
}
private void textBox1_Leave(object sender, EventArgs e)
{
StreamWriter Writer = new StreamWriter(Application.StartupPath + "/acct/info/user.user");
Writer.WriteLine(textBox1.Text);
Writer.Close();
}
private void textBox2_Leave(object sender, EventArgs e)
{
StreamWriter Writer = new StreamWriter(Application.StartupPath + "/acct/info/pass.user");
Writer.WriteLine(textBox2.Text);
Writer.Close();
}
private void textBox1_Enter(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
{
StreamReader userreader = new StreamReader(Application.StartupPath + "/acct/info/user.user");
textBox1.Text = userreader.ReadToEnd();
userreader.Close();
}
}
private void textBox2_Enter(object sender, EventArgs e)
{
if (checkBox2.Checked == true)
{
StreamReader passreader = new StreamReader(Application.StartupPath + "/acct/info/pass.user");
textBox2.Text = passreader.ReadToEnd();
passreader.Close();
}
}
internal static void DestroyHandle()
{
Form1.ActiveForm.Dispose();
}
}
}
modified on Sunday, May 9, 2010 1:35 AM
|
|
|
|
|
Yes, Using Settings in C#[^],
Oh, and try not to save passwords in plain form, encrypt them first.
I have no smart signature yet...
|
|
|
|
|
Hi guys,
I develop a csharp smart device project.My code is:
using System;
using System.Linq;
using System.Data.SqlServerCe;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace ModeDifféré
{
public partial class Form6 : Form
{
public Form6()
{
InitializeComponent();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void Form6_Load(object sender, EventArgs e)
{
string sConnection = @"Data Source=Admin-PC\MSSQLSERVER,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";
string sSQL = "SELECT Nbt FROM 4BT; ";
SqlConnection conn = new SqlConnection(sConnection);
SqlCommand comm = new SqlCommand(sSQL, conn);
SqlDataReader dr = null;
try
{
comm.Connection.Open();
dr = comm.ExecuteReader();
while (dr.Read())
comboBox1.Items.Add(dr[0]);
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
return;
}
dr.Close();
comm.Connection.Close();
}
}
}
When running this program and after turning off my Firewall(to enable all connections including TCP connections to SQL SERVER),This error appears
Specifid SQL server name not found:Admin-PC\MSSQLSERVER,1433
Thanks
Notes!!!
I work with:
- SQL SERVER 2005 standart edition
-Visual Studio 2008 entreprise edition
-windows Se7en
|
|
|
|
|
Try using the IP address instead of 'Admin-PC'.
|
|
|
|
|
Hi,
I tried like this:
string sConnection = "Data Source=192.168.1.4,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";
but the same error appears:Specified sql server not found or access denied
Thanks
|
|
|
|
|
Have a look at some connection string samples here-maybe that can help.
|
|
|
|
|
In the connection string you specify Admin-PC\MSSQLSERVER,1433 as the server. This means the computer name is Admin-PC, the instance name is MSSQLSERVER and the port to be used is 1433.
a) You should check if your sql server has an instance name.
b) you sould check that the port 1433 (TCP) is not blocked by any firewalls
c) You should check that the sql server instance is configured to accept network connections on the port 1433 (not dynamic port)
I have no smart signature yet...
|
|
|
|
|
Hi vlad,
the 2 suggestions a) and c) are verified but the b),really I don't understand how to verify it.
As a note,I turn off my Firewall and run my program but the same error stills.
Any help will be grantful
|
|
|
|
|
If the firewall is turned off then that should be ok, this means that the port is not blocked.
And if all the conditions are met, then you should be able to connect to your server, but you stil can't.
Try connectiong without telling the port in the connection string (something like @"Data Source=Admin-PC\MSSQLSERVER;Initial Catalog=GMAO;User ID=sa;Password=sa;" ), if this stil fails, try connectiong with other applications, like the sql management studio, or visual studio in order to see if it works.
If other applications work and your's fails then the problem is in the connection string (server name or instance name), else the problem is in the server configuration (like network access).
By the way, what is the exact error it you get?
I have no smart signature yet...
|
|
|
|