|
If you are just required to show the count then why do you require datagrid, you could simply assign to a control like label etc..
Check your datagrid too!What is the error?
Gautham
|
|
|
|
|
Thannk u.
Above this Data Grid I am diaplaying another Data Gird to Display all the records of the table and it is working fine.
To Match with that data grid I am using another Data Grid to display count.
I am just getting a blank Data Grid with no items.
Otherwise tell me how to insert a string value into a datagrid without binding the datagrid.
Thank U
Chandu
|
|
|
|
|
you have to write the code in the item databound event of the first datagrid, did you do that?
Gautham
|
|
|
|
|
No,I just call wrote all the functionality in Page Load event handler and it should be their for my logic.
-- modified at 3:48 Wednesday 16th May, 2007
Thank U
Chandu
|
|
|
|
|
Chandu,
The second datagrid where you want the count is in a datagrid so the logic for filling the second datagrid should be written in the itemdatabound event of the first datagrid.
If you do this way it would be fine!
Gautham
|
|
|
|
|
i try the following code:
public void RunOleDbTransaction(string myConnString)
{
OleDbConnection myConnection = new OleDbConnection(myConnString);
myConnection.Open();
OleDbCommand myCommand = myConnection.CreateCommand();
OleDbTransaction myTrans;
// Start a local transaction
myTrans = myConnection.BeginTransaction(IsolationLevel.ReadCommitted);
// Assign transaction object for a pending local transaction
myCommand.Connection = myConnection;
myCommand.Transaction = myTrans;
try
{
myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')";
myCommand.ExecuteNonQuery();
myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')";
myCommand.ExecuteNonQuery();
myTrans.Commit();
Console.WriteLine("Both records are written to database.");
}
catch(Exception e)
{
try
{
myTrans.Rollback();
}
catch (OleDbException ex)
{
if (myTrans.Connection != null)
{
Console.WriteLine("An exception of type " + ex.GetType() +
" was encountered while attempting to roll back the transaction.");
}
}
Console.WriteLine("An exception of type " + e.GetType() +
" was encountered while inserting the data.");
Console.WriteLine("Neither record was written to database.");
}
finally
{
myConnection.Close();
}
}
but i get the following exception : An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll
Additional information: This OleDbTransaction has completed; it is no longer usable.
this exception occure when : myTrans.Rollback();
Please help me avoid this exception.
Please advice.
|
|
|
|
|
Hi
Your code is working fine.
I commented all the catch Procedure and I executed your code.
It just giving the output and I also checked the table.Records are inserted.
Once check your catch block and execute it.
Cheers
Chandu
|
|
|
|
|
Thank you very muc h.
|
|
|
|
|
I need a store proc to convert text file to SQL2000 table using delimeter "|"
Rekha
|
|
|
|
|
awara wrote: I need a store proc to convert text file to SQL2000 table using delimeter "|"
Well congratulations on that. I need a donut - the difference is, somebody is just about to get me one.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Try the "BULK INSERT" SQL command with the "FIELDTERMINATOR" option.
|
|
|
|
|
1) Create the table.
2) Use the Bulk Insert sql statement. You can find the syntax and paramaters in BOL.
Jeff
|
|
|
|
|
Hi,
I was wondering if someone could point me in the right direction for the following problem:
I created a SQL database which includes a payment system to process customer payments, when defining the Table which will hold the Payments from customers, I couldn't decide if i should create a table for Payment Types (cash, credit card, checking etc...) and add a relationship for each customer payment to the Payment Type table, or use a set of predefined characters to identify payment types (S=cash, C=credit card, H=checking etc...)
A payment type table is definitely more in compliance with the relational database modal, but on the other hand, since i will at most only have 4 or 5 payment types it will offer much better performance since there is no joins and PK/FK constraints and it will save space as well.
|
|
|
|
|
Yet at you end up having a performance overhead when you end up having to convert the payment type back. Plus, what happens if you add a payment type? Add a row and get the functionality for free, or change a hunk of code to handle the new Quarterly Cash payment type that your customer wants?
Stick with the normalised version - the overhead of the fk isn't that great.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
You have a very good point about the performance (although its not in the db its in the app which is generally cheaper)
The problem of adding a new payment type hit me as well. Initially i decided i can save a list of payment types in a configuration file and add the new one there, i figured its not that often that i will be adding a new payment type anyway. But why reinvent the wheel when i can have that list saved in the db itself.
Thanks for the reply
|
|
|
|
|
Yona Low wrote: But why reinvent the wheel when i can have that list saved in the db itself.
Lovely jubbly. You know it makes sense.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi all.
I create Stored Procedure and in my procedure I coll other porcedures, but I get error message wen I try to "check syntax".
Ex:
<br />
CREATE PROCEDURE TEST_1<br />
as<br />
TEST_2 <br />
can help?
|
|
|
|
|
If yout want to call a other stored procedures use the keyword "execute"
CREATE PROCEDURE TEST_1
as
execute TEST_2
gILBERT
|
|
|
|
|
|
Hi Everyone:
I’m still struggling with the BindingNavigator control in Visual Studio 2005.
What I want to do is create a DataSet and populate it with data retrieved from a specific database table using a stored procedure. The code to accomplish this part is shown below.
'Connect to the database
Dim cn As SqlConnection = New SqlConnection()
cn.ConnectionString = My.Settings.DBConnectionString
'Retrieve the data using a stored procedure
Dim cd As New SqlCommand("mrmsp_ListBinding", cn)
'Declare the SQLDataAdapter and DataSet
Dim MySqlDataAdapter As New System.Data.SqlClient.SqlDataAdapter()
Dim MyDataSet As New System.Data.DataSet
'Set the database connection for MySqlDataAdapter
MySqlDataAdapter.SelectCommand = cd
'Fill the DataSet
MySqlDataAdapter.Fill(MyDataSet)
Now I need to set the BindingNavigator's DataSource to the DataSet we created as shown below.
'Set the BindingNavigator's DataSource to the DataSet we created.
naviBindings.BindingSource.DataSource = MyDataSet
This is where I’m running into trouble. I have a form that contains four text boxes. I want to bind each of these text boxes to a different field from the DataSet I created. A simple example would be:
TextBox1 = DataSet.Field1.Value
So First Question: How do I bind specific database fields from a DataSet to a specifc control on the form using VB.NET code?
Thanks,
Quecumber256
|
|
|
|
|
TextBox1.Text = DataSet.Tables[0].Rows[rowno][columnno].ToString()
Gautham
|
|
|
|
|
hello,
I want to use row and column in winform, it fill by user at runtime and save to database...:laugh
|
|
|
|
|
|
what is the solution to the timeout problem while filling some dataset using sqldataadapter.When the query tested in query analyzer generates result set after considerable time duration (like 20 seconds) .while the application doesnt stay for that long thus leaving the dataset empty .I also changed timeout value in web.config but it didnt work .
Madni
|
|
|
|
|
give a snapshot of your code
|
|
|
|