DataSource Controls :: Unable To See Default Databases?
Apr 17, 2010When I opened sql server configuration manager I am not able to see default databases like master etc. Does anybody know the reason? Did I miss any installation?
View 3 RepliesWhen I opened sql server configuration manager I am not able to see default databases like master etc. Does anybody know the reason? Did I miss any installation?
View 3 RepliesI have attached two databases (from an ASP.NET application to SQL Express). They have attached fine and are working alright but what disturbs me is when I go and check it from SQL management studio, I could see those databases at attached in SQLExpress but I couldn't open it out them there. I need to update them with many records and I want to open them. Any clue what I am missing? I could have sent you the screen shot but I dont know how to attach an image in this thread.
View 4 Repliesi dont know how to set the field to blank field instead of null
if i insert record, and don't input some field, then the field will display null
how to remove null value by default in mysql db.
Before I can upload my web site I need to merge my 6 small databases into one otherwise I am going to pay unreasonable hosting fees.Is there any easy way to do this?
View 4 RepliesI get this error message when I connect to the data source on localhostERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specifiedthe connection string is
connectionString="Data Source=DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;PORT=3306; DATABASE=database;UID=xxx;PWD=xxx;OPTION=3;pooling=false;"
providerName="System.Data.SqlClient"
it must be some kind of problem in the environment since the connection string works on a remote server. I downloaded the driver and added it with the Data source (ODBC) application in the control panel.
I want to transfer data from an acces database to a sqldatabase. This is my code:
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
#region page load
protected void Page_Load(object sender, EventArgs e)
{
}
#endregion
protected void click_Transfer(object sender, EventArgs e)
{
OleDbConnection conn1 = null;
OleDbDataAdapter da1 = null;
DataSet ds1 = null;
SqlConnection conn2 = null;
SqlDataAdapter da2 = null;
DataSet ds2 = null;
// 1 Opzetten dataAdapter en dataset
try
{
// Ophalen connectiestring en opzetten v/d connectie
string connString1 = ConfigurationManager.ConnectionStrings["PrinterConnectionString"].ToString();
conn1 = new OleDbConnection(connString1);
string connString2 = ConfigurationManager.ConnectionStrings["PrinterConnectionString2"].ToString();
conn2 = new SqlConnection(connString2);
// Aanmaken van DataAdapters
da1 = new OleDbDataAdapter();
da2 = new SqlDataAdapter();
// Opzetten SelectieCommand
string sql1 = "SELECT * FROM tblPrinter";
OleDbCommand cmd1 = new OleDbCommand(sql1, conn1);
SqlCommand cmd2 = new SqlCommand(sql1, conn2);
da1.SelectCommand = cmd1;
da2.SelectCommand = cmd2;
string sql2 = @"INSERT INTO tblPrinter(PRINTER_ID, tblSoortApparaat, MERK, MODEL, LOKAAL_ID )" +
@"VALUES (@id, @soort, @merk, @model, @lokaal)";
cmd2 = new SqlCommand(sql2, conn2);
// InsertCommand dataAdapter
cmd2.Parameters.Add("@id", SqlDbType.Int, 0, "PRINTER_ID");
cmd2.Parameters.Add("@soort", SqlDbType.NVarChar, 100, "tblSoortApparaat");
cmd2.Parameters.Add("@merk", SqlDbType.NVarChar, 100, "MERK");
cmd2.Parameters.Add("@model", SqlDbType.NVarChar, 100, "MODEL");
cmd2.Parameters.Add("@lokaal", SqlDbType.Int, 0, "LOKAAL_ID");
da2.InsertCommand = cmd2;
ds1 = new DataSet();
da1.Fill(ds1, "PRINTERS");
ds2 = new DataSet();
da2.Fill(ds2, "PRINTERS2");
// Stap 2: Start bewerking!!
DataTable table1 = ds1.Tables["PRINTERS"];
DataTable table2 = ds2.Tables["PRINTERS2"];
DataRow newrow = null;
for (int i = 0; i < table1.Rows.Count; i++)
{
newrow = table2.NewRow();
newrow["PRINTER_ID"] = i + 1;
newrow["tblSoortApparaat"] = table1.Columns[1].;
newrow["MERK"] = table1.Columns[2].DefaultValue;
newrow["MODEL"] = table1.Columns[3].DefaultValue;
newrow["LOKAAL_ID"] = table1.Columns[4].DefaultValue;
table2.Rows.Add(newrow);
}
da2.Update(ds2, "PRINTERS2");
lblMessage.Text = table1.Rows.Count.ToString() + " rijen zijn toegevoegd";
// bindgrid();
}
catch (Exception ex)
{
lblError.Text = ex.Message;
}
}
}
Here is my problem newrow["tblSoortApparaat"] = table1.Columns[1].; When i do that al the rows in my sql database are filt up with the columname. But i want the specik data. For example sql database:
1 tblSoortApparaat
2 tblSoortApparaat
3 tblSoortApparaat
But what i want is
1 PRINTER
2 PC
3 PRINTER
i want to know how to connect to multiple databases in sql from our asp.net code??
View 4 RepliesI'm using SQL Server Management Studio Express 2005. I have a database that I'm trying to make an exact copy of under a new name. I generated a script, made a new database then ran the script on it. My problem is the new database is short two objects, it shoudl have 840, but has 838.
I need to find out which two objects are not there.
Maybe there is a way to copy the exact database under a new name? I tried to detach, copy to a new name and then attach, but that did not work.
I used the Database Publishing Wizard to create a copy of my live SQL Server database for testing purposes. Both the live and test databases are hosted by my ISP.
What is the easiest way to transfer design changes from one database to the other without altering the data (assuming that the design changes are compatible with the existing data in the target database)?
Any proposed solution would have to be available via Visual Web Developer 2008 Express or SQL Server 2008 Development Edition.
I need to query two table from different databases residing on two different servers.
Scenario:
1st Server : Abc
Database: DB1
Table: Accounts
2nd Server: Xyz
Database: DB2
Table: Clients
The common linking information between Clients and Accounts is "email_id". I'm sure a lot you are saying why am I not maintaining both tables on single server but there is a lot going on behind scenes and if I move tables, I'll have to modify many dependent web pages.
I have a <asp:Parameter Name="Person_ID" Type="String" />. My Updatecommand contains, among other things: Person_ID = @Person_ID. That's all fine.
In my code behind, how to I say that I don't want to specify a value for this parameter, but rather want it to use the default value (which in this case is NULL?)
Or rather than telling it to use the Default value, is it possible to set it to Null? I tried setting the value to Null, but the sql code that got generated was Person_ID = "NULL", which of course, is wrong. How do I get it to generate Person_ID=NULL?
Some of you might know that I am currently working on a simple blog (thread with full details here). There is a slight problem however ! After achieving the post filtering, the blog doesn't show any posts, unless; I click on of the categories. I was hoping that the blog would show ALL posts at first, and THEN if a user clicks a Category, the filtering would occur. So I went over the code again, and there was this:
[Code]....
The DefaultValue="0" caught my eye, so I changed the number to "1" and I got all the posts in the [ General ] category, I tried "2" and I got the posts from the [ Programming ] category ..etc So I was thinking how I'd go about solving this problem, because (initially) I want the posts from ALL categories to show. Is it possible to add more than one defaultValue ? for example: DefaultValue = "1,2,3"
I have tried the above and it gave me errors, so obviously it doesn't work that way, but is there another way of adding more default values ? Or could you think of a different way to make all the posts show ?
I have 2 databases one called DB1, and the other DB2. Both of them has exactly the same design (tables, procedures and etc..)
Now, I am using SQLMETAL to create the DataContext. problem is that there are two lines that direct to a certain database and so I cannot use the same code for both databases.
here is the code:
[Code]....
Now, What I am lookin for is a programmatically way to change this two lines (DataBaseAttribute and the connrection string) .
The easiest solution for me of course is to create the class twice, with the same code and just change manually what I need which is not what I am looking for.
There is a full discussion with microsoft stuff right here: [URL]
I would like to create a gridview where all of the items in one table are listed and a checkbox is checked if that item also shows up in another table. The difficulty comes in the fact that table are not only in different databases, but possibly on different servers.
Is there any way to do this via ASP.NET connection strings, so that it doesn't matter where the databases live? I'd rather use connection strings, because I don't want to hard-code credentials into the queries (OPENROWSET or whatnot).
I am developing a website with ASP.NET pages that uses an SQL Server database with LINQ to SQL. I am using Visual Studio's Web Developer along with SQL Server 2008 (Developer Edition) database tables on my personal PC to develop this software. When ready, I intend to transfer the compiled web pages to a web hosting service with an SQL server database that is identical to the database on my PC.
I now have a version of my website deployed on a web hosting service at: [URL] and all of my database tables duplicated at the remote SQL server. However, this version of my website does not work with the database yet. I realize that I can have the VS Server Explorer connect to both databases, but I do not know if the web pages on my PC can use both databases interactively.
I am asking how I can develop my website to use the local SQL Server database and then have the deployed pages use the remote SQL Server database with LINQ to SQL. Do I need to create one version that works with the local database and another deployable version that works with the remote database? What should I do?
We have a webfarm using a SQL Server 2000 database to store our session state.
On the same SQL server are our databases for the rest of the websites. The databases are separate but on the same server.
Recently I found that one of our developers is using the session very inefficiently. He is storing large datatables within the session for users when he could accomplish the same thing through other methods.
Can this inefficient use of the session state (when stored in SQL Server) affect the performance of our main database when they are on the same server?
The answer seems to be yes, to some degree. However, I cannot find any documentation to back me up.
is it possible to change the default date values accepted by sql server to dd,mm,yyyy instead of the default mm,dd,yyyy?
View 3 RepliesI've created a table with a userId column of type uniqueidentifier, and have set that column as the primary key. In the column properties, under the Default Value or Binding, I've put (newid()). I thought that this would create a new uniqueidentifier if no value is specified in the insert statement.
However, when I try to add a new row in the table data view and leave the userId blank, it does not let me add the row. It gives me an error saying that the value cannot be NULL (since it is a primary key), however I had deliberately left it NULL so that it would add a new value by calling newid(). Have I made a false assumption?
I am using SqlDataSource control that retrieves information based on a city value from another control (textbox) on the page entered by the user.
[Code]....
The query works fine when the user enters a name of a city. However, if I leave the textbox blank and enter nothing, no records are returned by the query.I need all records to be returned when user leave the textbox blank and there is no value of the city.How to do that?is there a default value can do that?
I'm trying to pass default value to a sql parameter which is
[Code]....
I'm creating a site that will offer several different services (blogs, videos, images..), all under the same site.
Each service will use a separate database and all services must use the same membeship info. Users will only need one login to access all these services.
For the membership database i will use the default aspnetdb database.
There are two ways i can think of:
1) Use a join-query between two databases, each time i want to show some service records per user.
2) Create a custom membership-info table in each service's database, and keep it in sync with the master membership table in aspnetdb database.
The custom membership table will be like this:
Id - int, primary, identity
UserId - uniqueidentifier (of aspnetdb database)
What is the best way to do this in the long run, when i will have six or seven or more services ?
I'm trying to execute a simple insert statement with the GUID and timestamp populated by default from the server. I have both of their default values set as (newid()) and (getutcdate()) respectively in SQL server. However, I receive the error when I try and execute the command "Insert Error: column name or number of supplied values does not match table definition". How do I construct my sql insert so my id and timestamp columns use their default values as assigned in sql server?
[Code]....
I am using the query listed below which includes multiple joins, in the result of the query I need to do some value replacement valuesExample: db.ASSETS.BUILDING_ID=300 that ID does not exist in db.BUILDINGS, in that case I need to return BUILDING_ID=0, db.BUILDINGS.NAME="Unassigned"
[Code]....
i want to search for data in informix using a like('%Name1%') from my .NET application. The query that i have written is something like this:
select * from tableName where columnName Like CONCAT('%',CONCAT('Name1','%')) ......
this query when run from the front end does not yeild the desired result set ......however when i execute it from the db level i get the correct result .... also an intersting thin that i noted is ...if i do a LIKE('%' || 'Name1' || '%') from the front end i get a syntax error ...however this works just fine when i execute the query from the db...... ive spent over 10 hrs trying to figure this out ......but have not found a solution for it on my own ...... also, the following works perfectly :select * from tableName where columnName LIKE CONCAT('%','Name1') .....from the application...
likewise select * from table name where columnName like CONCAT(Name1,'%') works ...........* the vale fields need to be replaced with a '?' in the front end ...informix automatically replaces it when executing the command statement....so the commantext for all informix commands look something like this :
select ColumnName from tableName where columnName1 LIKE CONCAT('%',CONCAT(?,'%'))
parameter is 'Name1'
i have used the following connection string, but it only works for localhost, when i am trying to upload it on server it gives error.,error is specied below..it urgent plz resolve as soon as possible...
<add name="connectionname" connectionString="Server=servername;port=3307;User Id=xyz;Password=abc; database=databasename"/> Error - Unable to connect to any of the specified MySQL hosts. Exception Details:
MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts.