If txtPassword.Text = txtCpassword.Text Then
Dim StrTempChar As String
Dim i As Integer
Dim MyPwd As String
MyPwd = txtPassword.Text
For i = 1 To Len(MyPwd)
If Asc(Mid$(MyPwd, i, 1)) < 128 Then
StrTempChar = CType(Asc(Mid$(MyPwd, i, 1)) + 128, String)
ElseIf Asc(Mid$(MyPwd, i, 1)) > 128 Then
StrTempChar = CType(Asc(Mid$(MyPwd, i, 1)) - 128, String)
End If
Mid$(MyPwd, i, 1) = Chr(CType(StrTempChar, Integer))
Next i
Conn.Open()
Comm = New Data.SqlClient.SqlCommand
Comm.Connection = Conn
Comm.CommandType = Data.CommandType.Text
Comm.CommandText = "Insert Into customer (Emailid,Password,Userid,Add1,State,City,Pin,Title,Fname,Lname,Gender,Dob,Mobile,Regidate) " & _
" values('" & txtEmailid.Text & "','" & MyPwd & "','" & txtEmailid.Text & "','" & txtAdd1.Text & "','" & cmbState.SelectedItem.Text & "','" & txtCity.Text & "'," & txtPin.Text & ",'" & CmbTitle.SelectedItem.Text & "','" & txtFname.Text & "','" & txtLname.Text & "','" & cmbGender.SelectedItem.Text & "','" & BodDate.SelectedDate.Date & "'," & txtMobile.Text & ",'" & System.DateTime.Today & "')"
Comm.ExecuteNonQuery()
Conn.Close()
Adpt = New Data.SqlClient.SqlDataAdapter("select * from customer", Conn)
Dataset1 = New Data.DataSet
Adpt.Fill(Dataset1, "customer")
EmptyControls()
Else
'EmptyControls()
lblMessage.Visible = True
lblMessage.Text = "Try Again !.....Password and Confirm Password is not Match"
End If
Thanks in advance
Plz solve my problem as early as possible
Shah Shishir
Loading
AlanPosted Oct 3, 2008, 4:36 AM
This is straight off the top of my head so I don't know whether it will even compile but it should get you on the right track for dealing with VB's Mid() function in C# which is the only real problem here:
if (txtPassword.Text == txtCpassword.Text)
{
char tempChar = '\0';
string MyPwd = txtPassword.Text;
char[] PwdChars = MyPwd.ToCharArray();
for (int i = 0; i < PwdChars.Length; i++)
{
int c = (int)PwdChars[i];
if (c < 128)
{
tempChar = (char)(c + 128);
}
else if (c > 128)
{
tempChar = (char)(c - 128);
}
PwdChars[i] = tempChar;
}
MyPwd = new string(PwdChars);
Conn.Open();
Comm = new Syste.Data.SqlClient.SqlCommand();
Comm.Connection = Conn;
Comm.CommandType = System.Data.CommandType.Text;
Comm.CommandText = "Insert Into customer(Emailid,Password,Userid,Add1,State,City,Pin,Title,Fname,Lname,Gender,Dob,Mobile,Regidate) " +
" values('" + txtEmailid.Text + "','" + MyPwd + "','" + txtEmailid.Text + "','" + txtAdd1.Text + "','" + cmbState.SelectedItem.Text + "','" + txtCity.Text + "'," + txtPin.Text + ",'" + CmbTitle.SelectedItem.Text + "','" + txtFname.Text + "','" + txtLname.Text + "','" + cmbGender.SelectedItem.Text + "','" + BodDate.SelectedDate.Date + "'," + txtMobile.Text + ",'" + System.DateTime.Today + "')";
Comm.ExecuteNonQuery();
Conn.Close();
Adpt = new System.Data.SqlClient.SqlDataAdapter("select * from customer", Conn);
Dataset1 = new System.Data.DataSet();
Adpt.Fill(Dataset1, "customer");
EmptyControls();
}
else
{
//EmptyControls();
lblMessage.Visible = true;
lblMessage.Text = "Try Again !.....Password and Confirm Password is not Match";
}