G
Guest
I encountered an SQL exception when I load the following codes. The exception "SQL server does not exist or access denied, Line 0 .NET sqlclient data provider". I used the .NET smart device application and run it with its emulator or with a PDA the above exception occurred occasionally but if I run it using the compiled exe application on my computer it works perfectly. Can anyone help? Thanks alots for ur attention
string tempStr = "SELECT CountryCode " +
"FROM Inventory_Dept_Mapping " +
"WHERE (DeptCode = @DeptCode) " +
"GROUP BY CountryCode"
DataSet tempDS = new DataSet()
SqlCommand sqlCom = new SqlCommand(tempStr, new SqlConnection(DataBaseConnectionString))
sqlCom.Parameters.Add("@DeptCode", SqlDbType.VarChar)
sqlCom.Parameters["@DeptCode"].Value = this.DeptCode
SqlDataAdapter sAdapter = new SqlDataAdapter(sqlCom)
try
sAdapter.Fill(tempDS, "ctrycode")
catch (SqlException ex
MessageBox.Show(ex.Message + "\nLine " + ex.LineNumber + "\n" + ex.Source)
}
string tempStr = "SELECT CountryCode " +
"FROM Inventory_Dept_Mapping " +
"WHERE (DeptCode = @DeptCode) " +
"GROUP BY CountryCode"
DataSet tempDS = new DataSet()
SqlCommand sqlCom = new SqlCommand(tempStr, new SqlConnection(DataBaseConnectionString))
sqlCom.Parameters.Add("@DeptCode", SqlDbType.VarChar)
sqlCom.Parameters["@DeptCode"].Value = this.DeptCode
SqlDataAdapter sAdapter = new SqlDataAdapter(sqlCom)
try
sAdapter.Fill(tempDS, "ctrycode")
catch (SqlException ex
MessageBox.Show(ex.Message + "\nLine " + ex.LineNumber + "\n" + ex.Source)
}