Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- converting object to string has error
- SqlConnection scn = new SqlConnection(ClsPublic.GetConnectionString());
- SqlCommand scm = new SqlCommand("SELECT Name FROM Table WHERE (Blogger = @Blogger)", scn);
- scm.Parameters.AddWithValue("@Blogger", lblBloger.Text);
- scn.Open();
- MyLabel.Text = scm.ExecuteScalar().ToString();
- scn.Close();
- lblLastNo.Text = scm.ExecuteScalar().ToString();
- object Blogger= "";
- if (Blogger.ToString() != string.Empty)
- {
- ....
- }
- var result = scm.ExecuteScalar();
- MyLabel.Text = result == null ? '' : result.ToString();
- object blogger= "";
- if (blogger.ToString() != string.Empty)
- {
- ....
- }
- string str=blogger.toString();
- if (String.IsNullOrEmpty(str))
- //do something
- else
- //do other part
Add Comment
Please, Sign In to add comment