private void GetSubjectDetails(int id)
{
var conn = new SqlConnection(Connectionstring);
conn.Open();
var command = new SqlCommand("SELECT [sub_id],[sub_name],[lev_id],[hours],[status] FROM [DB_SchoolManager].[dbo].[tbl_subjects] where [sub_id]=@sub_id", conn);
command.Parameters.AddWithValue("@sub_id", id);
using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
TxtSubject.Text = reader["sub_name"].ToString();
TxtHours.Text = reader["hours"].ToString();
CbLevels.SelectedValue = int.Parse(reader["lev_id"].ToString());
if (reader["status"].ToString()=="Blocked")
{
CbStatus.SelectedIndex = 1;
}
else
{
MessageBox.Show(reader["status"].ToString().Length.ToString());
CbStatus.SelectedIndex = 0;
}
}
}
conn.Close();
}
CREATE TABLE [dbo].[tbl_subjects](
[sub_id] [int] IDENTITY(1,1) NOT NULL,
[sub_name] [nchar](200) NOT NULL,
[lev_id] [nchar](200) NOT NULL,
[hours] [nchar](200) NOT NULL,
[status] [nchar](200) NOT NULL,
CONSTRAINT [PK_tbl_subjects] PRIMARY KEY CLUSTERED
(
[sub_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
GO
What I have tried:
should i change
[nchar](200)
but i need to save in Arabic which unrecognized for it