TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Israel
692
1.3k
219.3k
How to save ONLY month and year in MSAccess database
Aug 5 2015 8:12 AM
Hi!
I need to save in my database from my datetimepicker only the MONTH and YEAR. But its doesnt works.
Then see what I do and help me to resolv my problem please:
conn = new OleDbConnection(connstr);
comm = new OleDbCommand();
conn.Open();
OleDbParameter name = new OleDbParameter("@name", SqlDbType.VarChar);
OleDbParameter monthyear = new OleDbParameter("@monthyear", SqlDbType.VarChar);
comm.Parameters.Add(name);
comm.Parameters.Add(monthyear);
name.Value = txtName.Text;
monthyear .Value = txtMonthYear.Text;
comm.Connection = conn;
comm.CommandText = "insert into DBTest ([name],[monthyear]) values(@name,@monthyear)";
if(MessageBox.Show("Are you sure to save?","Windows for Save",MessageBoxButtons.YesNo) == DialogResult.Yes)
{
try
{
comm.ExecuteNonQuery();
MessageBox.Show("Saved...");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
Reply
Answers (
8
)
Can I Host MVC Application on Linux With SQL Server?
Post a form from code and send the user "there"