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
tushar tayal
NA
1
8.2k
how to check the textbox value
Sep 27 2010 6:23 AM
pleaase tell me how to use the stored procedure in C#.NET
I am making a windowform in which i aminserted the data into the database.
In database one of my fiels is unique and cannot insert the duplicate value. please tell me how to check the value in textbox to the database.
my code is
DatabaseInfo database = new DatabaseInfo();
database.DatabaseName = "ALPHA";
database.ServerDsn = "DELLVOSTRO";
database.DbType = DatabaseType.Microsoft;
AlphaDatabaseManager alphadatabasemanager = new AlphaDatabaseManager(database);
SqlConnection conn = new SqlConnection("Data Source = DELLVOSTRO; Initial Catalog = ALPHA; Integrated Security = True");
DataSet localDataSet1 = new DataSet();
string sTable = "Insert Into COUNTRY (UNIQUEID , ISO_CODE , ALPHA_CODE , NUMERIC_CODE , NAME , CONTINENT) values('"
+ ultraNumericEditorUniqueID.Text + "','" + ultraMaskedEditIsoCode.Text + "','" + ultraMaskedEditAlphaCode.Text + "','"
+ ultraNumericEditorNumericCode.Text + "','" + ultraMaskedEditName.Text + "','" + ultraComboEditorContinent.SelectedItem.DataValue + "')";
SqlTransaction transation;
try
{
alphadatabasemanager.OpenConnection(conn);
transation = conn.BeginTransaction();
alphadatabasemanager.ExecuteNonQueryCommand(sTable, conn, transation);
alphadatabasemanager.CommitTransaction(transation);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
alphadatabasemanager.CloseConnection(conn);
MessageBox.Show("Data has been sucessfully inserted");
}
Reply
Answers (
1
)
Searching for a string in text file and storing the perticular line that matches the string
how to copy a sql server database using File.Copy function in C#