|
I don't know about Sybase, but with Oracle I've found that ODBC.NET works better than OleDb. The OleDb class doesn't support all the different field types available whereas ODBC.NET seems to.
Dave
|
|
|
|
|
Hi,
Is there a way to list all DB2 Servers on the network just like we do with SQLDMO for SQL Servers in C#.
Thanks and Regards,
Deepak Kumar Vasudevan
http://deepak.portland.co.uk/
|
|
|
|
|
I have Access 2000 database with number of forms. How can I make one of them default, which is loaded when database is opened?
|
|
|
|
|
Do you want to set this via the Microsoft Access application or through ADO/etc? I don't know about the latter approach (I've looked at all the "MSys" tables but can't see anything to suggest it, and the docs are useless as ever), but on the off chance it's the former look under "Tools | Startup..." in the main application menu.
|
|
|
|
|
Thank you, this is exactly what I need.
|
|
|
|
|
Hiya does anyone have any tutorials or links on using C++ with SQL. I know C++ already but want to learn SQL. I will be using Visual C++ 6.0.
All I know is there is a header file called sql.h.
Thanks for any help..
grahamoj.
|
|
|
|
|
|
karl_w wrote:
http://www.w3schools.com
I'll recommend that one too - W3Schools looks like a great site for learning and quick reference alike, and not just for SQL. It is now added to my bookmarks.
I just took each of their quick tests and got...
HTML: 20/20
XHTML 17/20
CSS: 19/20
XML: 19/20
JavaScript: 20/20
ASP: 20/20
SQL: 20/20
...so I guess I'll be spending my afternoon reading through the XHTML and XML sections. (I only got the CSS question wrong because I missread the question. Honest. *cough* )
|
|
|
|
|
I am trying to get optimistic concurrency to work updating the employees table onf the northwind database to which I have added a datetime column to act as a timestamp. I am having trouble setting the timestamp column in the dataset after updating the dataAdapter. The update command stored procedure works, but because I cannot update the dataViewstate.Original of the timestamp column I cannot perform another update to the same column without refilling the dataset. I know the "timeStamp" parameter is being set by the stored proceudre because I can retrieve the new timestamp value from the parameter in the datasets _RowUpdated event. It seems like the update to the columns should happen automatically base on what info I can find. AmWhat am I missing. Help. I have included the updateCommand and _RowUpdated code below.
Thanks,
Burke
// oleDbUpdateCommand1
//
this.oleDbUpdateCommand1.CommandText = "[up_Employees_Update]";
this.oleDbUpdateCommand1.CommandType = System.Data.CommandType.StoredProcedure;
this.oleDbUpdateCommand1.Connection = this.oleDbConnection1;
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("RETURN_VALUE", System.Data.OleDb.OleDbType.Integer, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("employeeID", System.Data.OleDb.OleDbType.Integer, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(10)), ((System.Byte)(0)), "EmployeeID", System.Data.DataRowVersion.Current, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("firstName", System.Data.OleDb.OleDbType.VarWChar, 10, "FirstName"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("lastName", System.Data.OleDb.OleDbType.VarWChar, 20, "LastName"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("title", System.Data.OleDb.OleDbType.VarWChar, 30, "Title"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("timeStamp", System.Data.OleDb.OleDbType.DBTimeStamp, 8, System.Data.ParameterDirection.InputOutput, false, ((System.Byte)(0)), ((System.Byte)(0)), "TimeStamp_ST", System.Data.DataRowVersion.Original, null));
private void oleDbDataAdapter1_RowUpdated(object sender, System.Data.OleDb.OleDbRowUpdatedEventArgs e)
{
int rowsUpdated = (int)oleDbDataAdapter1.UpdateCommand.Parameters["RETURN_VALUE"].Value;
string employeeName = oleDbDataAdapter1.UpdateCommand.Parameters["FirstName"].Value + " " + oleDbDataAdapter1.UpdateCommand.Parameters["LastName"].Value;
if (rowsUpdated != 1)
{
e.Command.Cancel();
addToListBox("Attepmt to update employee:" + employeeName + " returned " + rowsUpdated.ToString());
}
else
{
addToListBox("RowUpdated returned:" + oleDbDataAdapter1.UpdateCommand.Parameters["RETURN_VALUE"].Value.ToString() + " TimeStamp was :" + oleDbDataAdapter1.UpdateCommand.Parameters["TimeStamp"].Value.ToString());
}
DateTime dt = (DateTime)oleDbDataAdapter1.UpdateCommand.Parameters["TimeStamp"].Value;
addToListBox("New timestamp for " + employeeName + " = " + dt.ToString());
e.Row["TimeStamp_ST"] = dt.ToString();
e.Row.AcceptChanges();
// for (int i=0;i<=e.Row.Table.Columns.Count; i++)
// {
// addToListBox(e.Row.Table.Columns[i].ColumnName.ToString());
//
// }
//e.Row["TimeStamp"] = (DateTime)oleDbDataAdapter1.UpdateCommand.Parameters["NewTimeStamp"].Value;
//object str = (object)e.Row["NewTimeStamp",DataRowVersion.Original];
//addToListBox("TimeStamp str=" + str.ToString());
//DataRow cr = e.Row["TimeStamp",DataRowVersion.Original];
//cr["TimeStamp",DataRowVersion.Original] = (DateTime)oleDbDataAdapter1.UpdateCommand.Parameters["NewTimeStamp"].Value;
}
|
|
|
|
|
Hi everybody
I am using SQL Server 2000. The size of my actual data is 110MB. On the other hand the size of the respective transaction log is 7GB. Is the logical? If not is there a way to reduce it? Note that I use SQL Server's 2000 shrink menu option but the size will not reduce. IMHO this is tooooo much!!!!
Thank you in advance for your help
Spiros Prantalos
Miami the place to be!!
|
|
|
|
|
Go to the properties of your database, on the "Options" tab, choose "simple" recovery model, and make sure autoshrink is set.
|
|
|
|
|
Thank you very much!! That was the solution!!
Spiros Prantalos
Miami the place to be!!
|
|
|
|
|
The problem I have is as follows:
I have a large number of classes (each having different data members, over 300) which I wish to store the member data within a data blob in a SQL DB (Just one data table). The DB table has the class type and a data blob. Upon retriving the data from the table, the class type is viewed to determine which class to address, and then call the class to extract the data blob. In C++ I would have used a memcpy(), is there a good way of creating and extracting the data blobs, or equiverant to memcpy without having to use unmanaged code.
|
|
|
|
|
Hi
i am newbee in ADO .NET , just curious to know ,whats equivalent to cursor in ADO .NET or how does ADO .NET uses Cursor and LOCKS !!
P.S. PATWAL
|
|
|
|
|
i need to insert huge database in sql table
the problem
1) i need to know any method/process by which u may guess the connection has break
2) if connection is brek i need to roll back all the inserts
any idea ?
P.S. PATWAL
|
|
|
|
|
First of all, you didn't mention how you contact your database and what db you use (or do you mean MS SQL-Server by "sql table"?)
1) Can't say any particular without knowing how you contact database. But you could check the return value of your data-access-method. There should be an error code for lost connection.
2) If you don't use autocommit, it should be the database's job not to store any data that's not commited.
--
karl
|
|
|
|
|
hi thanks for paying attention to my query
i got solution for my problem
i just needed to use transation for updates
thanks again !
P.S. PATWAL
|
|
|
|
|
Hello
I have som problem i hope you could help me with
First of al:
My computer name JIMMY-217
I have installd Mysql on my local computer and done no changes to it(it is running)
I have installd the SQL Server Service Manager, and its running(but i dont know where the sql files i located or how to change them).
I have the MyODBC installd(working)
My problem is to get connected with MySQL servern in C#.
I have tryed on the foolowing ways
closed the SQL Server Service Manager and only have the MySql(WinMySQLAdmin) running
this is the connection code:
SqlConnection dataConnection = new SqlConnection();<br />
dataConnection.ConnectionString = "Integrated Security=true;Initial Catalog = mysql; Data Source=localhost"; <br />
<br />
dataConnection.Open();
But i get the Following error:
Cannot open database requested in login 'mysql'
mysql is a database that is i in the mysql server from start as example or somthing, if this is wrong how do i type to get the correct connection(adress)
I have tryed this turtorial(http://www.devarticles.com/art/1/250) and got it working with the Access file, but not with the SQL server.
If i start up the SQL Server Service Manager and make som changes for example
(Initial Catalog = Northwind), then it will connect to this server but it will say that it cant find the database, but this is not so inportant i think, the main thing is to get the connection to MySQL servern to work.
I hope you got som ides on this problem
I have on more problem, in the mysql(WinMySQLAdmin) -> databases i cant get teh creat and delete commands, i think it has somthing to do with the login, i have to login on root or somthing, but how do i login with a diffrent user? i have tryd to change the my.ini but this didnt help.
Best Regards
Jimmy
|
|
|
|
|
The SqlConnection from the System.Data.SqlClient is for connecting to a MS SQL Server. If you are trying connect to your MySql, try a OLEDB provider and use the OleDbConnection class.
Other way is by using the ODBC.NET library from MS.
I see dumb people
|
|
|
|
|
Thanks for the help
I Think this code is right but i need to connect it to MySql.
OleDbConnection Myconnection = null; <br />
OleDbDataReader dbReader = null; <br />
<br />
Myconnection = new OleDbConnection (@"Provider=Microsoft.Jet.OLEDB.4.0; User Id=; Password=; Data Source=C:\familyTree.mdb"); <br />
Myconnection.Open();
I dont know how to change this code so it will work with mysql(have look along time)
I know that i have to change the User Id and pass to one that can loggon to the SQL server, but what do i change the Data Source to? (my computer name is JIMMY-217, but i dont know how to get the right adress to connect)
Then the first((@"Provider=Microsoft.Jet.OLEDB.4.0;) i probely have to change to.
Hope you have an ide on this
Best regards
Jimmy
|
|
|
|
|
In addition to what has already been posted, you might want to try the tool at this link:
http://www.devhood.com/tools/tool_details.aspx?tool_id=655[^]
It seems to be a fully-managed provider for MySQL. I haven't tried it myself, but I did download the personal version (free). If you want to deploy it in a product or "real" application, it costs a little, but you get more features such as transactions, connection pooling, etc.
As was mentioned before, the SqlClient classes are designed specifically for MS SQL Server.
RabidK
|
|
|
|
|
But cant i use OLE DB to connect to MYSQL
if i can how will the connection line look like
//Jimmy
|
|
|
|
|
I don't think you can use the OLEDB connection for MySQL.
Use ODBC.NET, it works just fine.
Dave.
|
|
|
|
|
I have manage to connect to my local mysql database with this code
System.Data.OleDb.OleDbConnection con;<br />
con=new System.Data.OleDb.OleDbConnection("");<br />
con.ConnectionString="Provider=MySQLProv;Data Source=mysql;";<br />
<br />
<br />
try<br />
{<br />
con.Open();<br />
if (con.State==ConnectionState.Open) MessageBox.Show("Connection to MySQL opened through OLE DB Provider");<br />
con.Close();<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}
How do i do to delete, change, read etc in this database, and how do i send mySQL commands with this? Do i realy have to use ODBC.NET to this?
I have installed ODBC.NET but it simes like the C# dont find the namespace using Microsoft.Data.Odbc
|
|
|
|
|
Have a look at the OleDbDataReader and OleDbCommand classes. These allow you to execute SQL against the database.
If you want to use ODBC.NET, you need to add a reference to it in visual studio. If you've got it to connect with OleDB however, theres not much advantage in using ODBC.
Dave.
|
|
|
|