Hello, We are using SQl as the DB for our application. Now we lost direct acess to the DB, but we can acess through the application. How we will get the direct acess back? The network side is ok. We don't know how it happened. can anybody help me to resolve this?
Is it possible to access a file (for example, to write in a text file)with transact-sql?.I've create a stored procedure and I'd like to write in a log filesome traces depends on the result of the statements executed in thisstored procedure.Thanks
if (!Page.IsPostBack) { if (Session["users"] != null && (Session[flag"] == "true")) { String IP = Request.ServerVariables["remote_host"].ToString(); String Datee = DateTime.Now.Date.ToString(); OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" + HttpContext.Current.Server.MapPath("~/App_Data/result.mdb")); OleDbCommand cmd = new OleDbCommand("Insert Into KullaniciSayisi (IP,Datee) Values (IPDatee)", con); cmd.Parameters.AddWithValue("IP", IP); cmd.Parameters.AddWithValue("Datee", Datee); con.Open(); intresultt = cmd.ExecuteNonQuery(); con.Close(); Session["flag"] = "false"; } } I want to convert this code to SQL sever . However I can not do it? Can you help me?
I am using Vista Business with Visual Web Developer and Sql Server Express 2005. I want to be able to access the data from two tables in a query. Both tables are attached to the application. To refer to the two databases I have used the following DATABASE.OWNER.TABLE (specifically TaskMgr.dbo.TaskTable) For both databases I get the error "Invalid object name" What am I missing? Thanks
hi i was reading book about asp.net and i found example for a dataacess class but i didn't understand this part
Private m_FieldData As New NameObjectCollection Private _m_ConnectionString As String Private m_dbConnection As SqlConnection Private Sub AddParameters( _ ByVal objCommand As SqlCommand, _ ByVal objValues() As Object)
Dim objValue As Object Dim I As Integer Dim objParameter As SqlParameter
I = 0 For Each objParameter In objCommand.Parameters If objParameter.Direction = ParameterDirection.Input _ Or objParameter.Direction = _ ParameterDirection.InputOutput Then
objValue = objValues(I) objParameter.Value = objValue I = I + 1 End If Next End Sub
Private Sub AddFieldParameters _ (ByVal objCommand As SqlCommand)
For Each objParameter In objCommand.Parameters objParameter.Value = _ _FieldData.Item(objParameter.ParameterName. _ Substring(1)) Next End Sub Public Function ExecDataReader _ (ByVal strStoredProc As String, _ ByVal ParamArray objValues() As Object) _ As SqlDataReader
Dim objCommand As SqlCommand Dim objReader As SqlDataReader
Try objCommand.Connection.Open() If (objValues.Length = 0) Then AddFieldParameters(objCommand) Else AddParameters(objCommand, objValues) End If objReader = objCommand. _ ExecuteReader(CommandBehavior.CloseConnection) Catch ex As Exception If objCommand.Connection.State.Open Then objCommand.Connection.Close() End If End Try
Return objReader End Function can anybody help me what the author want to do
Using Web Matrix I made and tested a query using the Sql wizard acessing a SQL server table and it worked fine. Web Matrix created the following connection string, in the function to create the query : "server='(local)'; trusted_connection=true; database='AVAL_360'" But when the function created to execute the same query,my application then the following error showed up. Login failed for user What is the matter ? Can someone help me ? Thanks in advance
Hello,I am unable to access SQL Server 2005 (Express Edition) when i am creating wesites on localhost.But the same database can be accessed without any problem when websites are created on local file system.When creating the website on localhost and trying to access databse the following error is displayed: " Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed."Anyone plz help me out of this? Thanks.Ashu.
I currently have an issue trying to access my database in SQLexpress2005. Whenever i try to start the service it errors out. I looked at the error in event viewer and it says says "The log scan number passed out to log scan in database 'master' is not valid. This error my indicate data corruption or that the ldf does not match the mdf....."
How can i fix this problem seing as though i can not access studio manager to restore the db?
hi. i got a question regarding the permission on share folder. i wonder i am able to do this as below.. if on runtime, after i export the data to xmlfile and i want it to auto save into the SHARE Folder in sql server. can i do that ?
** after press a button, auto export data to xml file, then auto save the xml file to share folder.
We have a MS Access .adp app which is having some security problems. We have a windows global group which is a user - which is added to a role. The developers are having problems with unqualified sql statements trying to find user.table instead of dbo.table. It seems we are not able to specify a default schema for the global 'user' - the option is greyed out and a sql statement fails. MS says: Default Schemas
A default schema is used to resolve the names of securables that are referred to without their fully qualified names. In SQL Server 2000, name resolution first checks the schema owned by the calling database user, followed by the schema owned by dbo.
In SQL Server 2005, each user has a default schema. The default schema can be set and changed by using the DEFAULT_SCHEMA option of CREATE USER or ALTER USER. If DEFAULT_SCHEMA is left undefined, the database user will have dbo as its default schema.
Is the default truly undefined in a global group user? We are not totally locked in to the global group solution, but it does make admin easier for us.
Hi, I'm using ComponentArt's Callback grids with Manual Paging.
The CA example grid uses Access:(http://www.componentart.com/webui/demos/demos_control-specific/grid/programming/manual_paging/WebForm1.aspx)
That SQL syntax produced is invalid in SQL Server 2005.
Example: "SELECT TOP " & Grid1.PageSize & " * FROM (SELECT TOP " & ((Grid1.CurrentPageIndex + 1) * Grid1.PageSize) & " * FROM Posts ORDER BY " & sSortColumn & " " & sSortOrderRev & ", " & sKeyColumn & " " & sSortOrderRev & ") ORDER BY " & sSortColumn & " " & sSortOrder & ", " & sKeyColumn & " " & sSortOrder
So...This is what I have (simplified), and it appears return incorrect rows on the last few pages: SELECT top 15 * FROM Posts where & sFilterString & " and Postid in (SELECT TOP " & ((Grid1.CurrentPageIndex + 1) * Grid1.PageSize) & " Postid FROM Posts where " & sFilterString & " ORDER BY " & sSortColumn & " " & sSortOrder & ") " & " ORDER BY " & sSortColumn & " " & sSortOrderRev
What other approaches has anyone used besides the "ID in (...)"?The examples I have included show the available variables: sort asc and desc, current page, number of rows on a page, etc.
Hello everyone.Whenever I tried to access my database, I would get an error which stated "SQL server does not exists or access denied". My connection string would be as follows:private string connectionstring = "Data Source=local host;Database=pubs;User ID=sa;Password=sa";the password being set to sa. this connection string never worked and I always got the above error. However on changing the Data Source to the computer name the connection string worked and I gained access to my database. How's that? Can anyone please explain to me why should the computer name work for the data source and not the server name. As far as the syntax is concerned the data source should be the name of the server and not computer name. regardsHarsh R. Saxena
iam working with http location and using sql server 2005 its getting an error as "SELECT permission denied on object UserDetails' database 'elearning', schema 'dbo'." "UserDetails" is my table name "elearning" is database name i worked same project with filesystem location ,there it is working
iam working with http location and using sql server 2005 its getting an error as "INSERT permission denied on object CourseDetails, database 'mydb', schema 'dbo'." "CourseDetails" is my table name "mydb" is database name i worked same project with filesystem location ,there it is working
I've started getting an issue with this command..It's trying to access a specific directory and I am getting 'Access is Denied'..Something has been changed in the last couple of weeks and I'm not sure what it is
I suspect that security on the folder has been amended..How do I find which account xp_cmdshell runs as so I can go to our networking department and have them check the AD account?
i made a database in phpmyadmin, and used all information given by the service provided, but i can't grant access do my user.'
i can alter and change my database from phpmyadmin, but when i try a command like "grant select on database.table_name to 'user'@'%';" to be able to view the table from a website, i get "#1142 - SELECT,GRANT command denied to user 'xxx'@'xxx.xxx.net' for table 'xxx'"
Hi, i'm facing a problem, I have SQL Server 2000 instaled, the problem is when I try to connect using another computer, it can see the server, but when I try to connect i receive a Access Denied message. My TCP port is opened, and I can enter in the remote server using Query Analyzer, but I can't start the server using SQL Server Service Manager.
All have IIS and an replicated intranet site http:/server/intranet All have 2 DSN connections set exactly the same except one using TCP one using named pipes)
DC1's web app will access a search on SQL1 using named pipes but not TCP SQL1 as above WEB1's web app will not access a search on SQL1 using any of the DSN connections.
Errors recieved
Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC SQL Server Driver][Named Pipes]Access denied.
SQL is in mixed secuirty mode.
I am unable to work out the above no matter how much I play with teh permissions.
IIS on all Servers use Windows Authentication. The SQL database is set to allow all Domain Users access.
I'm writing a web application invovled SQL 2005. I had granted SQL Server user rights to the ASPNET as the procedure described in MSDN (http://msdn2.microsoft.com/en-us/library/e2t54ss5.aspx) . Therefore, there's no problem of connection. But when I try to insert some data into the database, I met an exception told me that the INSERT permission is denied. I try the same mdf file on another computer while the insertation succeeded. So I'm wondering is anything difference in security settings between my computer and the one succeeded? I also try the sample database Northwind, but same problem occurred. I'm sure it is problem of security settings other than the .mdf file itself. The following is the detailed error information: Product: Microsoft Visual Studio Version: 8.0 LCID: 1033 Type: System.Data.SqlClient.SqlException Language: C# API: System.Data.SqlClient.SqlCommand.ExecuteNonQuery [Sytem.Data.SqlClient.SqlException]: "INSERT permission denied on object 'Employees', database 'Northwind', schema 'dbo'," ErrorCode: -2146232060 Class: 14 LineNumber: 1 Number: 229 Server: (local)SQLExpress State: 5 Message: INSERT permission denied on object 'Employees', database 'Northwind', schema 'dbo'
I've a data access code as below to insert two data into my sql server db. but there is an error occur. which permission is denied. before this i'd tried to read data from the dataase, it doesn't has any permission denied. Public Function newRegister(ByVal uName As String, ByVal uPass As String) As Boolean Dim valid As Boolean = False If findMember(uName) = False Then conRegister.Open()Dim sqlCmd As System.Data.SqlClient.SqlCommand = conRegister.CreateCommand() sqlCmd.CommandType = CommandType.Text sqlCmd.CommandText = "Insert into Logon (UserName, Password) Values(@UserName, @Password)"sqlCmd.Parameters.AddWithValue("@UserName", uName) sqlCmd.Parameters.AddWithValue("@Password", uPass)
sqlCmd.ExecuteNonQuery() conRegister.Close() valid = True End IfReturn valid End Function