Guest User

Untitled

a guest
Aug 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. converting object to string has error
  2. SqlConnection scn = new SqlConnection(ClsPublic.GetConnectionString());
  3. SqlCommand scm = new SqlCommand("SELECT Name FROM Table WHERE (Blogger = @Blogger)", scn);
  4. scm.Parameters.AddWithValue("@Blogger", lblBloger.Text);
  5. scn.Open();
  6. MyLabel.Text = scm.ExecuteScalar().ToString();
  7. scn.Close();
  8.  
  9. lblLastNo.Text = scm.ExecuteScalar().ToString();
  10.  
  11. object Blogger= "";
  12. if (Blogger.ToString() != string.Empty)
  13. {
  14. ....
  15. }
  16.  
  17. var result = scm.ExecuteScalar();
  18. MyLabel.Text = result == null ? '' : result.ToString();
  19.  
  20. object blogger= "";
  21. if (blogger.ToString() != string.Empty)
  22. {
  23. ....
  24. }
  25.  
  26. string str=blogger.toString();
  27. if (String.IsNullOrEmpty(str))
  28. //do something
  29. else
  30. //do other part
Add Comment
Please, Sign In to add comment