sql server 3.5
-
con.Open(); string select = "select * from main_stock where stockid='" + comboBox1.Text + "'"; SqlCeCommand selcom = new SqlCeCommand(select, con); SqlCeDataReader reader = selcom.ExecuteReader(); reader.Read(); if (reader.HasRows == true) { MessageBox.Show("error"); } con.Close(); this code work access databse but sql server 3.5 compact server notwork
-
con.Open(); string select = "select * from main_stock where stockid='" + comboBox1.Text + "'"; SqlCeCommand selcom = new SqlCeCommand(select, con); SqlCeDataReader reader = selcom.ExecuteReader(); reader.Read(); if (reader.HasRows == true) { MessageBox.Show("error"); } con.Close(); this code work access databse but sql server 3.5 compact server notwork
lankaudaranga wrote:
this code work access databse but sql server 3.5 compact server notwork
What do you mean by "not work". Exactly, how does it not work? What is the error you get?
Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux * Mixins My Blog
-
lankaudaranga wrote:
this code work access databse but sql server 3.5 compact server notwork
What do you mean by "not work". Exactly, how does it not work? What is the error you get?
Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux * Mixins My Blog
EROOR massege display "hasrow" not supports
-
EROOR massege display "hasrow" not supports
-
You should had posted the full error description. Any hows do it this way if(dr.Read()) { //your code here }
Ahsan Ullah Senior Software Engineer
YES reader.Read(); if (reader.HasRows == true) { MessageBox.Show("STOCK ID ALREADY EXITS", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); comboBox1.Text = ""; comboBox1.Focus(); } BUT ITS NOT WORK :(
-
YES reader.Read(); if (reader.HasRows == true) { MessageBox.Show("STOCK ID ALREADY EXITS", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); comboBox1.Text = ""; comboBox1.Focus(); } BUT ITS NOT WORK :(
lankaudaranga wrote:
reader.Read(); if (reader.HasRows == true)
NO! That is not what was told to you.
if(reader.Read()) // Doesn't require HasRows
{
// your code here
}Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux * Mixins My Blog
-
lankaudaranga wrote:
reader.Read(); if (reader.HasRows == true)
NO! That is not what was told to you.
if(reader.Read()) // Doesn't require HasRows
{
// your code here
}Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux * Mixins My Blog
i want to send data to database but data not duplicate(hasraw==true) if (reader.HasRows == true) { //data already exite no data insert.display massege ..... } else { enter data(insert data } {you undastand this)
-
i want to send data to database but data not duplicate(hasraw==true) if (reader.HasRows == true) { //data already exite no data insert.display massege ..... } else { enter data(insert data } {you undastand this)
Yes, I understand you. However, you don't seem to understand me. To spell it out:
if (reader.Read())
{
// There is data - do something
}
else
{
// There is no data - do something else.
}So, as you can see, and as I explained earlier, you do not need
HasRows
.Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux * Mixins My Blog