Showing posts with label display. Show all posts
Showing posts with label display. Show all posts

Sunday, March 11, 2012

Cannot View Master.sysdatabase Names in Webpage

I have a webpage that should display the database names from the master.sysdatabases in a dropdownlist.

The code for the stored procedure works fine in Query Analyzer and returns the list of all database names under that instance of SQL-Server 2000.

The code:

select name from master.dbo.sysdatabases
order by 1

doesn't return the sysdatabase names to the ASP.NET webpage when executing the stored procedure.

It returns:

System.Data.DataRowView

Why does it do this and how can I fix it?

Tx

I don't know what you are trying to do but the Master database and it's content are Microsoft Property, I don't think you can use them in your web application. If you look inside the Master or look at the System tables Poster you know using those tables in your application is not something you do. Hope this helps.|||Probably a permissions issue.|||

Thanks.

The lookup is for our administrative/development purposes.
Since we have multiple databases to search through, the app shows the databases, you select a database, there's a lookup and display of tables, views and sprocs, and the contents are displayed in a large textbox for cutting and pasting purposes.

So the sysdatabases lookup is needed to select though the production databases.

The sproc doing the work has remote privs.
Other than that, how would you assign a priv to access the tables?
I didn't need it in QA.

Your help is appreciated.

|||I don't think it's a security/permissions issue. The built-in stored procedure sp_databases, which does exactly what your sql query does, has its execute permissions default to thepublic role. I think the problem is in your code, so you should post your code snippet here.|||

A quick test is to run this in both the webpage and your QA and see the difference:

SELECT SUSER_NAME(),USER_NAME()

That will tell you who are logged into SQL Server as, and what login are you being mapped to.

Although, rereading your original message, herman is most likely correct. It appears that your .NET code is wrong, considering that system.whatever.dataview is a .NET class, I would say that you've assigned a dataview to a variable using the .ToString method, or have done so implicitly.

Thursday, March 8, 2012

Cannot update record in database.

Hello,

I was stuck when update database using SqlDataAdapter. I have several textboxes in my webform1. When wepform1 is loaded, they will display user's information. The user can only input content in two textboxes. When user clicks the update button, I hope to update this record in SQL Server 2000 database. However, the program didn't work. There was no error message reported but when I stepped into the code, I found out that dataadapter's update method didn't succeed. I got 0 rows affected. Can I get some advice from someone ?

Here is the code:

string StrUpdateCmd = "Update Table1 Set Hphone = @.Hphone, Cphone = @.Cphone, Team = @.Team Where emailname =@.emailname ";

SqlDataAdapter UpdateDa = new SqlDataAdapter("Select * from Table1",SqlConnection1);
UpdateDa.UpdateCommand = new SqlCommand(StrUpdateCmd, SqlConnection1);

//Add parameters of update command.
SqlParameter prm1 = UpdateDa.UpdateCommand.Parameters.Add("@.Hphone",SqlDbType.NVarChar, 16);
prm1.Value = txtHphone.Text ;

SqlParameter prm2 = UpdateDa.UpdateCommand.Parameters.Add("@.Cphone",SqlDbType.NVarChar, 16);
prm2.Value = txtCphone.Text ;

SqlParameter prm3 = UpdateDa.UpdateCommand.Parameters.Add("@.Team",SqlDbType.NVarChar, 16);
prm3.Value = this.DropDownList1.SelectedItem.Value ;

SqlParameter prm4 = UpdateDa.UpdateCommand.Parameters.Add("@.emailname",SqlDbType.NVarChar, 50);
prm4.Value = txtEmail.Text;

try
{
DataSet dataset2 = new DataSet();

//Open database connection.
SqlConnection1.Open();
dataset2.Clear();
UpdateDa.Fill(dataset2, "Table1");

this.DataGrid1.DataSource = dataset2.Tables[0] ;
DataGrid1.DataBind ();

//Update database
int ret =UpdateDa.Update(dataset2,"Table1");
if( ret == 1 )
{
ShowMessage("Update succeed!");
}
else
{
ShowMessage("There is an error in updating ");
}

UpdateDa.Fill(dataset2);

//Show data after update.
this.DataGrid1.DataSource = dataset2;
DataGrid1.DataBind ();
}
catch (Exception ex)
{
throw ex;
}
finally
{
sqlConnection1.Close();
}In your Page_Load event handler, do you only bind from the database when IsPostback==false?

Wednesday, March 7, 2012

Cannot start your application. The workgroup information file is missing or opened exclusively b

hye everyone,
when i browse my web application the eror as below display..
what should i do..
any suggestion or tips...

"Cannot start your application. The workgroup information file is missing or opened exclusively by another user.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Cannot start your application. The workgroup information file is missing or opened exclusively by another user. "

thanks in advance..
thank you very much..

That is not a SQL Server problem as you aure using obviously MS Access, you better post your question to one of the Access forums in the public newgroup network. But, as far as I can remember from my old Access days, you will have to delete the lock file which is located in the same folder as the workgroup file which contains the security informa′tion.

Jens K. Suessmeyer

http://www.sqlserver2005.de