|
hi
i am working on a project that need to transaction between a database on server and application on client.
but i dont know how set the connection string and anything else to need to be set for this goal.
please tell me a solution or website or toturial sample for this problem.
thank you.
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
|
oh i think that you didnt understand my means
i want to set a connection string and anything else on server for connect to a database on the server via application that runs on clients pcs. i test the usuall connection string like webserver connection string that used for asp.net or localhost connection string that used in local application but these technique does not work.
if you know some information about server settings for work with database please help me.
thank you again.
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
mr.mohsen wrote: webserver connection string that used for asp.net
No such thing, but, whatever...
You don't "set" the connection string on the server. A connection string describes how and what a client should connect to to get at a certain database.
Since you don't make any mention of which database engine your trying to connect to, and/or how you're providing credentials to login, how the database is setup to accept credentials, ..., it's impossible for anyone to tell you what the connection string might look like.
So, have a look at http://www.connectionstrings.com[^].
|
|
|
|
|
A few quick guidelines:
1) A subject in the forum message should be a quick hint of your problem.
2) Typos normally tend to discourage serious experts from paying heed to your query. You ought to pay a little attention to ensure that your query is clean.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
Hey buddies ........ I just started to make local area chat ............ I can send and recieve stream of data but how do i know whether the connected client(s) are disconnected or not while chatting?
One other thing I want to ask is ................. How can I send Images with each other in this clients ..... and to display one image from one client to another clients picture box? ................
I appreciate your help. Thank you.
|
|
|
|
|
If they disconnect, the socket dies.
Sending an image is the same as sending text really, but if you previously only sent text you'll need a way to keep text and images apart (just stick an int in front of them or something like that)
|
|
|
|
|
Thank you for your help .....
harold aptroot wrote: If they disconnect, the socket dies.
so .... is there a method or something to know which socket dies(i mean which user disconnected)? I think it looks silly question.
Thank you agian
|
|
|
|
|
Of course, when you're trying to use a socket and it throws an exception, then that's the socket which died
|
|
|
|
|
|
Hi,
use a static integer variable to count the active clients in your main thread of server. each time a client connects count 1 up. and decrease if the clients disconnects.
bye
|
|
|
|
|
Yes, I thought in that way but .... I want to know when they are disconnected ... my question really here.... How do I know when one client is disconneted.
Thank you man.
|
|
|
|
|
here, when i Click a button then connect to Database server and program run properly
|
|
|
|
|
In button click event, write connection string. this will lead to connect to your database. which database you are using?
|
|
|
|
|
Rahad
Will you PLEASE go and buy a book on C# and database programming, work through it and come back when you can ask an intelligent question.
|
|
|
|
|
Dont you go round encouraging him now!
var question = (_2b || !(_2b));
|
|
|
|
|
I did check his history before I became 'encouraging', there seems to be a rash of teach me programming, build my database type post today.
|
|
|
|
|
Hi, I've written the WorkbookEvents_SheetCalculateEventHandler event to trigger for recalculation in Excel.
public event Excel.WorkbookEvents_SheetCalculateEventHandler SheetCalculate;
SheetCalculate = new Excel.WorkbookEvents_SheetCalculateEventHandler( ThisWorkbook_SheetCalculate);
The function Workbook_SheetCalculate(object Sh) triggers when there is a formula change in the excel sheet.
My aim is to read the function result from the Sh object.
for example, if A1=15, A2=17 and A3=SUM(A1,A2)
Workbook_SheetCalculate fires as soon as there is change in A1 or A2. I need to read the function result,32. Please guide me to get the value.
Thanks in advance.
|
|
|
|
|
Hello
In my application i am having a datagridview with a combobox column
and the data in the combobox is binded with a company table in database.
and the display member field is binded with column "Company Name" and
the Value field is binded with column "Company Id".
When i click on the save button i like to save the selected display
member and also the value field.
Plz tell me how i can do this...
Thanks in advance...
|
|
|
|
|
Hi I've few Java code and want to convert exact C# code can anybody help me out?
public static String calculateRFC2104HMAC(String data, String key, String signatureMethod)
throws SignatureException
{
String result = "";
try
{
SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), signatureMethod);
Mac mac = Mac.getInstance(signatureMethod);
mac.init(signingKey);
byte rawHmac[] = mac.doFinal(data.getBytes());
result = Base64.encodeBytes(rawHmac);
}
catch(Exception e)
{
throw new SignatureException("Failed to generate HMAC : " + e.getMessage());
}
return result;
}
|
|
|
|
|
|
Hi,
What I am trying to achieve is that in the winforms application I am creating (a journal one), it allows multiple users to register/login and add/edit/delete their entries, my questions are:
1. How do I create the application that allows different users to login?
2. Once logged in, how will the application know which user is which and to update the logged in user's particular entries?
Like in PHP you can use sessions do this easily, but how to do it in C#?
I have created a simple register and login form right now, but the difference of user is my problem, I am using the SqlceDataReader but I can only login with the last user that exists in the DB and if a change that user's password, every user's password in the db is changed to that particular password. Is it better to use datasets?
Here are the relevant bits from my code for both winforms:
Main form:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlServerCe;
[STAThread]
static void Main()
{
MainForm frmLogin = new MainForm();
frmLogin.ShowDialog();
}
private void btnLogin_Click(object sender, System.EventArgs e)
{
if (txtuser.Text.Equals(""))
{
MessageBox.Show("Please Enter User Name", "Organiser", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (txtpwd.Text.Equals(""))
{
MessageBox.Show("Please Enter Password", "Organiser", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
int count = 0;
con = new SqlCeConnection();
con.ConnectionString = "Data Source=Database.sdf";
com = new SqlCeCommand("select * from [User]", con);
con.Open();
if (con.State == ConnectionState.Open)
{
SqlCeDataReader dtr = com.ExecuteReader();
while (dtr.Read())
{
us = dtr["username"].ToString();
ps = dtr["password"].ToString();
if (us == txtuser.Text && ps == txtpwd.Text)
{
count = 1;
}
else count = 2;
}
}
if (count == 1)
{
MessageBox.Show("Login successful " + us, "Login", MessageBoxButtons.OK, MessageBoxIcon.Information);
ChangePassword pass = new ChangePassword();
pass.ShowDialog();
}
else if (count == 2)
{
MessageBox.Show("WRONG USER NAME OR PASSWORD ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btnRegister_Click(object sender, System.EventArgs e)
{
this.Close();
this.Dispose();
RegisterUser reg = new RegisterUser();
reg.ShowDialog();
}
private void btnExit_Click(object sender, System.EventArgs e)
{
this.Close();
this.Dispose();
Application.Exit();
}
private void MainForm_Load(object sender, EventArgs e)
{
}
private void MainForm_Load_1(object sender, EventArgs e)
{
}
}
}
For changing password:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlServerCe;
private void btnCancel_Click(object sender, System.EventArgs e)
{
this.Close();
this.Dispose();
}
private void btnSave_Click(object sender, System.EventArgs e)
{
MainForm mf = new MainForm();
int count = 0;
string connectionString = "Data Source=..\\..\\Database.sdf";
SqlCeConnection conn = new SqlCeConnection(connectionString);
conn.Open();
if (conn.State == ConnectionState.Open)
{
SqlCeCommand com;
com = new SqlCeCommand("select * from [User]", conn);
SqlCeDataReader dtr = com.ExecuteReader();
while (dtr.Read())
{
string pass = dtr["password"].ToString();
username = dtr["username"].ToString();
password = txtNew.Text;
if (pass == txtOld.Text)
{
count = 1;
string query = "UPDATE [User] SET password = '" + password + "' WHERE username = '" + username + "'";
try
{
SqlCeCommand myCommand1 = new SqlCeCommand();
myCommand1.CommandText = query;
myCommand1.Connection = conn;
myCommand1.ExecuteNonQuery();
MessageBox.Show(username +"'s password changed to " + password, "Password change", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Problem.");
}
} else count = 2;
if (count == 2)
{
MessageBox.Show("WRONG USER NAME OR PASSWORD ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
conn.Close();
}
}
}
Thanks
|
|
|
|
|
Hi,
first of all a question: Do you want to build a Windows Forms Application or an ASP.NET application (because PHP is web-based as ASP.NET is). When you use ASP.NET you got a session object, just like in PHP.
Second: The way you validate username and password is not really the safest one. I suggest using a query within a prepared-statement, passing the username and passwords as statements.
Regards
Sebastian
|
|
|
|
|
SeMartens wrote:
Second: The way you validate username and password is not really the safest one.
Safest? It's flawed badly!
Of course you can only log in as the last user in the db, because that's when your while loop ends.
Even when and if your username and password is correct for some other user, and you set the count variable to 1, the next time the loop.. .erm... loops it will change it back to 2. Unless it's the last record.
To the author:
But yeah, the way you do it is really ugly, though. Imagine you had 500k users. Would you put all the records in the memory then, and iterate through them?
Ever heard of the "WHERE" clause for T-Sql? ;>
var question = (_2b || !(_2b));
|
|
|
|
|
Haha, its only in the early stages of development lads, just like I am a novice at this.
Could you guys provide me with examples as to how I can do it better.
PS. I am creating a winforms application only, no ASP.NET or nothing. Its a standalone app.
Thanks
|
|
|
|