Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I sending data from 3 text-box to server program , and the server will know that the data received is from more than one text-box ??

the scenario is :
I want to make a client/server , the client will register "email , username , password " in the database in the server
how the server will know that the data come from more than one text-box , while the data send as bytes from client to server ??


thanks in advance :)
Posted
Comments
swapnilKumbhar 14-Apr-12 3:51am    
If you want to store email,username and password in DataBase then use simple insert query having server DB path.
maxpower12345 14-Apr-12 4:05am    
how I will know that the user name is have this length and the password and so on ?
what if the user name is more than 10 char ?
while the data will sending as a array byte through TCP/IP
maxpower12345 14-Apr-12 4:20am    
can I do this in client side

ASCIIEncoding encoder = new ASCIIEncoding();
byte[] buffer = encoder.GetBytes(textBox1.Text );
byte[] buffer1 = encoder.GetBytes(textBox2.Text);
byte[] buffer2 = encoder.GetBytes(textBox3.Text);
ClientStream.Write(buffer, 0, buffer.Length);
ClientStream.Write(buffer1, 0, buffer1.Length);
ClientStream.Write(buffer2, 0, buffer1.Length);


????????
Bala Selvanayagam 14-Apr-12 5:41am    
I would have thought, if you want to write into the SQL database in the server then
you may have to open a connection from the client to the database and use an insert SQL statement and not sure why you want to use "ClientStream"..Can you please go into more detail and tell us what you are trying to achieve please ?
maxpower12345 14-Apr-12 16:00pm    
I open connection and use a Stream
but how the database will separate the reserved data to column ?

1 solution

Hello

1. Create a stored procedure in SQL Server CREATE PROCEDURE (Transact-SQL)

2. I don't know what application is as client (WinForm/Web/WPF)
But:
set TextLenght of the TextBoxes
You can use Regular expressions for validating email address.
.NET Framework Regular Expressions

3. Call your stored procedure from your application and set its values.
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET
 
Share this answer
 
Comments
maxpower12345 14-Apr-12 16:27pm    
thanks
number 2 seems helpful :)

but I thought that there is specific way to send data from client to "server database"
Shahin Khorshidnia 14-Apr-12 17:00pm    
Yes, There are many ways. A secure way is Web service. For example WCF. If you search google you will see!
maxpower12345 15-Apr-12 6:31am    
I google it , but ..
I programming a "server program" in C# , so I don't know if the WCF can work with my program "the server" together ?
Shahin Khorshidnia 15-Apr-12 7:35am    
What do you mean?!
WCF is for SOA programing and if you want to have a web service for your application then you can use WCF. It depends on you if your application can work with WCF or not (Not to WCF)
maxpower12345 15-Apr-12 14:51pm    
thanks a lot :)

I understand now , your solution so helpful :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900