|
Try this link.
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hello to all,
I'm having kind of an issue with populating my entities.
I have a Data Access for appointments. One time I will call a stored procedure returning me only the id, time and length of the appointment. Another time I will also receive the customer and the threatments of the appointment. (Sort of an agenda/customers overview for a Pet Barber..)
I use a RunStoredProcedure method, to wich a pass the sp and the parameters.
This method uses an SqlDataReader and returns a collection of appointments (in this case).
In the method, to populate the entity, I use a PopulateEntity method, and that's where things go wrong. Since I'm not always populating the same number of properties, I sometimes call columns in the datareader that aren't there.
Now, I could solve this, checking for a null value in the PopulateEntity method, but I'd rather have a more dynamic solution in wich I can pass the Properties to fill, and their respective column.
Any nice way to do this? Can I pass object-properties by using attributes? Or am I on a wrong track here?
Any help is welcome, tnx
|
|
|
|
|
Hi Friends,
i want to move the record pointer of DataGridView using code in C#.
i m trying BindingMangerBase but the problem is this only passion of bmb changing but the record pointer of dgv is not moving.
the same is working fine with VB.NET. this is a code of VB.NET
Public Class frmTest
Dim bmb As BindingManagerBase
Dim bs As New BindingSource
Private Sub frmTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
connDB()
End Sub
Private Sub connDB()
Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0; Data Source = D:\TEMP\TestADO\DB\db1.mdb;")
Dim da As New OleDbDataAdapter("Select * From tblAdd;", cn)
Dim dt As New DataTable
Dim ds As New DataSet
da.Fill(dt)
bs.DataSource = dt
dgv.DataSource = bs
bmb = BindingContext(bs)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
bmb.Position = 0
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
bmb.Position = bmb.Position + 1
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
bmb.Position = bmb.Position - 1
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
bmb.Position = bmb.Count - 1
End Sub
End Class
here is the code of C# which is not working fine
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace testBindings
{
public partial class Form1 : Form
{
private SqlConnection conn ;
private SqlDataAdapter da;
private DataSet ds;
public BindingSource bs;
public BindingManagerBase bmb;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
conn = new SqlConnection ("Data Source=myhome\\sqlexpress;Initial Catalog=ChickenPeoxX;Integrated Security=True");
da= new SqlDataAdapter ("select * from tblGroup;",conn );
ds= new DataSet ();
da.Fill(ds,"GROUP");
dgv.DataSource = ds.Tables[0];
bs = new BindingSource( );
bmb = BindingContext[bs];
bs.DataSource = ds.Tables[0];
}
private void button1_Click(object sender, EventArgs e)
{
bmb.Position = bmb.Position+ 1;
textBox1.Text = bmb.Position.ToString() ;
}
private void button2_Click(object sender, EventArgs e)
{
bmb.Position = bmb.Position-1;
textBox1.Text = bmb.Position.ToString();
}
}
}
please help me with this ...
thnX in Advance
Regards
Sonal
.::HuNTeR::.
|
|
|
|
|
|
Muammar© wrote: saving changes using the automatically generated save button on the navigation tool strip
I think it requires adding code to update the data table adapter.
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
Thanx but i already have this:
<br />
this.Validate();<br />
this.pROFILEBindingSource.EndEdit();<br />
this.pROFILETableAdapter.Update(this.dataSet1.PROFILE);<br />
it's just not working
All generalizations are wrong, including this one!
|
|
|
|
|
and i want to share it in the forum for those who may run into the same stupid problem!!
invalid host/bind name was because i used the keyword "DESC" as a field name in the table im referencing in the database, it was stupid cuz oracle accepted it very well!! so i thought it's fine to name a field with a keyword but not the table, and what's more, it binds normally to the control when loading "which means the field name is only fine for reading!" but when trying to launch the adapter.update(dataset) you get this wonderful error that has nothing to do with the real problem!! i'v always hated oracle's error messages cuz they never lead me to the cause of the error!
cheers
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Glad you found the solution, and thanks for sharing
|
|
|
|
|
hi
can any body tell me connection string for c#.net for accessing access data base located on remote system on my lan,, i cannot create the connection strin
thanks in advance
hello
|
|
|
|
|
ghumman63 wrote: can any body tell me connection string for c#.net for accessing access data base located on remote system on my lan,, i cannot create the connection strin
That depends on your network. However, you can see examples of connection strings here[^] that should help you create the correct connection string.
|
|
|
|
|
Colin Angus Mackay wrote: you can see examples of connection strings here[^]
Dude! You beat me to it :->
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
in sql server2005 is it possible to add a new column in view,other than than select column names from table name
|
|
|
|
|
Rmesh wrote: in sql server2005 is it possible to add a new column in view,other than than select column names from table name
I don't understand what you mean. Do you want to add a column to the view that does not exist already in a table? If yes, then you can only add computed columns. The view contains no data whatsoever, it can only link to existing data therefore any column on the view must be exsting data or derived from existing data.
|
|
|
|
|
hi everyone, it's my first time here in this part of the forum and i'll be greatly thankful if i can get some help from ado experts,
im trying to connect to oracle db from c# when i get this error
(ORA-00911 Invalid Character)
ConnectMe = new OracleConnection("Data Source=orcl;Persist Security Info=True;User ID=DLDSP;Password=LIVE8;Unicode=True");
ConnectMe.Open();
OracleCommand cmdProfile = new OracleCommand("SELECT DName FROM Profile;", ConnectMe);
DAdap = new OracleDataAdapter(cmdProfile);
DSet = new DataSet();
DAdap.Fill(DSet); // **** I'm getting the error on this step **** //
please help!
All globalizations are wrong, including this one!
|
|
|
|
|
Hi Friends ,
I want to create a table in which , i want to declare some fields as encrypted at the time of creation so that tha data entered in that fields could not be seen by anybody .
Can you please guide me.
Thanking you ,
Param.
param
|
|
|
|
|
param thaker wrote: I want to create a table in which , i want to declare some fields as encrypted at the time of creation so that tha data entered in that fields could not be seen by anybody .
This is not possible in SQL Server 2000. It may be possible in SQL Server 2005, but I doubt it. Certainly you could use CLR stored procedures to encrypt and decrypt data, however doing so on key or indexed columns is not advisable because it will dramatically hurt the performance of your database.
|
|
|
|
|
Hi,
I installed sql server management studio 2005 in my windows 2003 OS system,at yesterday(08-Dec-2006).But today(09-Dec-2006),it is not worked.what is the reason for not working sql server management studio 2005 in my system?
Please Help me.
Thanks in Advance,
T.Rameshkumar
|
|
|
|
|
P.T.R.K wrote: I installed sql server management studio 2005 in my windows 2003 OS system,at yesterday(08-Dec-2006).But today(09-Dec-2006),it is not worked.what is the reason for not working sql server management studio 2005 in my system?
You need to supply more information. Did you change anything between yesterday and today?
|
|
|
|
|
I have a database and a form. When I load the form, the database will get converted into an XML file and will get displayed in my form. If I change some values in the xml which is displayed in my form, those changes should get reflected in my datagrid(which shows the contents of the database) and also in my database. So far, I can update the datagrid but not the database. How can I do this? Any kind of help would be sure appreciated.
rachael
|
|
|
|
|
hi rachael, im not sure but try this link.
All generalizations are wrong, including this one!
|
|
|
|
|
I tried this, but i is not updating the database. It is just getting appended to the already existing rows.
|
|
|
|
|
That's funny!! it is updating just fine with me!! please try again and make sure.
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
I tried it again, I don't know why the new data are just getting appended but not updating the database.
rachael
|
|
|
|
|
In the 12 years ive been developing software ive never been so stumped on one issue for so long...
I took over the design of the companies web application from my boss.
I tidied up 75% of the code and now have a pretty tidy way of doing things as follows...
each page inherits a page called 'basePage', this has all the necessary functions in it for data manipulation, such as...
<br />
GetConnection() as SqlConnection (returns it unopened but populated with the connection string)<br />
GetDataTable(sql as string) as DataTable<br />
ExecuteQuery(sql as string) as integer<br />
etc...<br />
Recently we started getting "Timeout Expired" errors "while obtaining a connection from the pool".
Ive tried various extremities of parameters in the connection string such as "min pool size=5;max pool size=1000;connect timeout=90;". and have read numerous articles on the subject.
I have also turned off connection pooling entirely and still receive the same error (differing only by not mentioning "the pool").
Before you ask - yes, i am using try catch blocks in my basepage functions and always closing and disposing my objects in the finally block.
Today i received no less than 840 timeout error reports on the server in one hour - there was only 46 people using the application at the most within that hour.
The timeouts seem to happen all at once for a few minutes, like a big bottleneck. The server itself was running fine - not even brushing 50% cpu usage. But the web application itself would slow down quite badly, taking up to a minute to serve the page.
I set up some tracing and noticed that some pages made no less than 60 calls per page load to the GetConnection() method
This is due to various business objects being called and checking data etc...
Before i even suggest that any of the business model be redesigned, id like to ask.. has anyone ever come across this type of situation before?
are most of you spitting coffee on your monitor over the 60 page calls like i nearly did?
or have you seen this before in big applications with many components?
Any help, comments or suggestions are welcomed.
Regards,
Guy
---Guy H ( ---
|
|
|
|
|
Guy Harwood wrote: I set up some tracing and noticed that some pages made no less than 60 calls per page load to the GetConnection() method
Is the code closing the connection before getting another?
Guy Harwood wrote: are most of you spitting coffee on your monitor over the 60 page calls like i nearly did?
You might want to see if you can rationalise some of these calls. For example, if you alwasy call the same three stored procedures in sucession then you might be able to create a wrapper stored procedure that calls the other three so you can only doing one call to the database. You can then iterate over the result sets and pull out multiple sets of data from one database call. (If you are using DataReaders the NextResult() method is the one that moves to the next result set)
The thing that causes the most slow down in an application is roundtrips to the database. If you can reduce the number of roundtrips it would improve performance, and reduce the number of connections you are making.
I'll also admit that I've never had to alter the timeout of the connection from the 15 second default.
By the way, what edition of SQL Server are you using?
|
|
|
|