i use ms sql server 2005 evaluation version. i just want to get an asp
project to work. not to edit, just to work, on my local machine. for
that i use asp studio 2005. (which processes the asp files). i am
almost done, asp is processed, runs, even server connection is up.
but for hours, i cannot establish a working connection, i cannot login
to the ms sql server from the asp scripts. i try and try, nothing
works. i always get [note: this is my own translation from german, not
the actual english error msg] 'error when logging in user bla. this
user isn't assigned to any trusted sql connection.'
i am absolutely new to ms sql and asp. i myself actually develop in
php/apache/mysql. i don't have time to go deeper - i just want to run
this project, for viewing only. *please can anyone tell me what and
where exactly i have to set in ms sql server management studio 9.0*
???!!!
what i did so far:
- set the auth mode to "sql server and win";
(however the manager is connected through win auth because of that
very error)
- my conn string currently is
PROVIDER=SQLOLEDB;DATA SOURCE=DANIEL; Initial Catalog=dbo; User
ID=bla;Password=fasel; (dbo is the database name, DANIEL is the mssql
server name)
- in managemnet studio, in security>auth (?, anmeldungen), where sa
etc is, i created bla, with password=fasel; and in databases>dbo i
added bla to users (i hope so/it looks like).
i also tried integrated security =true or =sspi, instead of user and
pw, resulting in a different error: like "error while processing a
multistep ole db thing, check out the ole db status values. " i would
really like to do that - if I knew how and where! =)
sorry i dont understand all these options and dont want to - just
desperately wish to get this blo*** =) asp project to work. isnt there
any simple solution? any simple setting to do...??!! thanx such a
lot!!!!!!!
I found out that I could use SQLDMO to enumerate objects in a SQL server. However, I can't connect to my server, even though I have both "windows and SQL server" authentication on "(local) Windows NT".
Here is the code (it does not contain the validation in this snippet):
Imports System.Data.SqlClient Imports SQLDMO
Public Class ADO_2 Inherits System.Web.UI.Page Protected WithEvents txtQuery As System.Web.UI.WebControls.TextBox Protected WithEvents txtresults As System.Web.UI.WebControls.TextBox Protected WithEvents lstDB As System.Web.UI.WebControls.DropDownList Protected WithEvents lblResult As System.Web.UI.WebControls.Label Protected WithEvents cmdExecute As System.Web.UI.WebControls.Button Protected WithEvents cmdNext As System.Web.UI.WebControls.Button
Private m_objConn As New SqlConnection() Private m_objSQLServer As SQLDMO.SQLServer
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
EnumerateDatabases()
'TEMP lstDB.Items.Add("Northwind") lstDB.Items.Add("Pubs") 'END TEMP End Sub
Private Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Unload
m_objConn.Close() 'Just in case..... End Sub
Private Sub cmdExecute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExecute.Click
Dim objCommand As SqlCommand Dim objDataReader As SqlDataReader Dim intField As Integer
objCommand = New SqlCommand(txtQuery.Text, m_objConn) objDataReader = objCommand.ExecuteReader
While objDataReader.Read txtresults.Text &= vbNewLine For intField = 0 To objDataReader.FieldCount - 1 txtresults.Text &= objDataReader(intField).ToString.PadRight(15) Next End While
m_objSQLServer = New SQLDMO.SQLServer() m_objSQLServer.Connect("radu")
'Iterate through all databases on the target server: For Each objSQLDatabase In m_objSQLServer.Databases lstDB.Items.Add(objSQLDatabase.Name) Next objSQLDatabase
EnumerateDatabasesExit: objSQLDatabase = Nothing m_objSQLServer.Close() m_objSQLServer = Nothing Exit Sub
EnumerateDatabasesError: lblResult.Text = Err.Number.ToString & ", " & Err.Description Resume EnumerateDatabasesExit End Sub End Class
Why can't I connect with m_objSQLServer.Connect("radu") ? I also tried m_objSQLServer.Connect("radu", "", ""). Otherwise, I can connect just fine with m_objConn.Open() (after I select a db from the dropdownlist, which is for now populated by hand)....
I have a Server running Windows 2003, windows firewall offline, with Sql Server 2005 and SQL Server 2005 Mobile Edition. This server is running behind a firewall.
When I try to PULL data with RDA from the internal network, all work's great! But when I try it from the exterior, internet, I always receive this message: Failure to open SQL Server with given connect string. [ connect string = Provider=sqloledb;Data Source=<MY INTERNET IP>,11433;Network Library=DBMSSOCN;Initial Catalog=testdb;User Id=sqlceuser;Password=test; ]
On my firewall, I unblocked port 80 and 11433 and mapped them to my internal server IP with port 80 and 1433. I use port 11433 on internet because my ISP block the 1433.
If File.Exists("My DocumentsPraiaDB6.sdf") Then File.Delete("My DocumentsPraiaDB6.sdf") End If
Dim engine As New SqlCeEngine engine.LocalConnectionString = localConnection engine.CreateDatabase() engine.Dispose() MsgBox("DB Mobil empty created!")
'Init RDA Object Dim rda As SqlCeRemoteDataAccess = Nothing
rda = New SqlCeRemoteDataAccess(rdaUrl, localConnection) rda.InternetUrl = rdaUrl rda.LocalConnectionString = localConnection rda.Pull("Reserva", "select * from Reserva", rdaOleDbConnectString, RdaTrackOption.TrackingOn) rda.Dispose()
the problem is in rda.Pull(...) it can not connect to rdaOleDbConnectString
I just can't get it to connect to the database. Says something that remote connections are not allowed. I've done the Area thing and allowed all connection including remote connections.
Hi I am new to .net and sql server....i have just installed VS 2005 and sql server7.0... I am doing my coding in vb.net......so i wanted to know the connection of the datagrid to the db in my sql server 7.0. Can some one pls help me with this urgently.
Hi, sorry but I am just getting my feet wet with the ADS wizard. I have managed to get the PPC emulator running the ADS wizard and have the emulator ActiveSync connected with desktop. Port 1024 opens from the emulator to the desktop. On the ADS wiz I can connect to the device .sdf. WHen I try to connect to the desktop I am getting a connection failure in the ADS wiz log and after stepping through the code VS watch window gives the following message for the SQL exception:
Message "Failure to open SQL Server with given connect string. [ connect string = Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Northwind.accdb; Jet OLEDBystem Database=C:\Documents and Settings\vhaporellinr.POR-EE778886\Application Data\Microsoft\Access\system.mdw ]" string
I do not know enough to know where to go next to move past this no-doubt simple problem. Can you direct me to the appropriate docs or refs to start digging into looking for solutions?
Is there a particular Northwind.mdb file that is supposed to be used?
Are we talking some kind of permissions issues on the database?
I was assuming I did not have to install SQL Server 2005 and the SQL Server management console(?) to do development with the SSCE. Is that correct?
THank you for any helping pointers you can provide.
I have 2 DropDownList, the first one to display the product category and the other one to display the products based on the selected category. However, when I run code I received the following error message: Input string was not in a correct format. Please find the code below. Thanks, Andy. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"><title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="Name"> </asp:DropDownList>
I designed the AlwaysOn wrong, but every time we fail over from primary server to another server, my applications cannot connect because the sql logins cannot connect to their default databases. Once I run the command to link the login with the user in the default database then the users are able to connect. Did I do something wrong when designing AlwaysOn?
I try to import my SSIS packages which are created using the Business Intelligent studio into SQL server 2005 but I cannot do that.
I am running SQL server 2005 enterprise edition.
Also when i tried to connect to Integration services using Object explorer, it only prompt me for server name. I cannot change the username and password which is disabled.
Then how am i supposed to connect to Integration services on a server in this case?
I'm having a problem connecting with a Java application but I CAN connect using my .Net application - the user name and password are the same for both (using the same database on SQL Server Express 2005).
The error I get is: "com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "CORNERS" requested by the login. The login failed." An interesing note - I get the same message if the database is not running.
SQL Server Express 2005 is installed in mixed mode.
Here is my connection string in the .Net appplication: <add key="connectString" value="Server=(local);UID=sa;PWD=myPasswd;Database=CORNERS" />.
I have a scenario where in I need to use a comma delimited string as input. And search the tables with each and every string in the comma delimited string.
We have some URLs within a bulk block of text some of which are very long. I need to identify rows where such urls exceed say 100 characters in length in amongst other text.So the rule would be return a record if within the string there is a string (without spaces) longer than 100 characters.
I have following query which return me SP/Views and Functions script using:
select DEFINITION FROM .SYS.SQL_MODULESNow, the result looks like Create proc create procedure create proc create view create function
I need its result as:
Alter Procedure Alter Procedure Alter Procedure Alter View Alter Function
I used following
select replace(replace(replace(DEFINITION,'CREATE PROCEDURE','Alter Procedure'), 'create proc','Alter Procedure'),'create view','Alter View') FROM .SYS.SQL_MODULESto but it is checking fixed space like create<space>proc, how can i check if there are two or more spaces in between create view or create proc or create function, it should replace as i want?
I am trying to insert a row into a table of Microsoft SQL Server 2000.
There are various columns.
[SNO] [numeric](3, 0) NOT NULL , [DATT] [char] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [DATTA] [char] (3000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [CODECS] [char] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
The [DATTA] column is causing a problem. Even if I am trying to put only 1700 character string into [DATTA], the java code throws the following exception:-
StaleConnecti A CONM7007I: Mapping the following SQLException, with ErrorCode 0 and SQLState 08S01, to a StaleConnectionException: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Connection reset
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
Why is it throwing an exception even though the sum-total of this row doesn't exceed 8000 characters?
Hello to all, I have a problem with ms sql query. I hope that somebody can help me. i have a table "Relationships". There are two Fields (IDMember und RelationshipIDs) in this table. IDMember is the Owner ID (type: integer) und RelationshipIDs saves all partners of this Owner ( type: varchar(1000)). Example Datas for Table Relationships: IDMember Relationships . 3387 (2345, 2388,4567,....) 4567 (8990, 7865, 3387...) i wirte a query to check if there is Relationship between two members. Query: Declare @IDM int; Declare @IDO int; Set @IDM = 3387, @IDO = 4567; select * from Relationship where (IDMember = @IDM) and ( cast(@ID0 as char(100)) in (select Relationship .[RelationshipIDs] from Relationship where IDMember = @IDM))
But I get nothing by this query. Can Someone tell me where is the problem? Thanks
Hello, I am tring to add a string my database. Info is added, but it is the name of the string, not the data contained within. What am I doing wrong? The text "Company" and "currentUserID" is showing up in my database, but I need the info contained within the string. All help is appreciated!
Imports System.Data Imports System.Data.Common Imports System.Data.SqlClientPartial Class _DefaultInherits System.Web.UI.Page
Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserWizard1.CreatedUser 'Database ConnectionDim con As New SqlConnection("Data Source = .SQLExpress;integrated security=true;attachdbfilename=|DataDirectory|ASPNETDB.mdf;user instance=true") 'First Command DataDim Company As String = ((CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Company"), TextBox)).Text) Dim insertSQL1 As StringDim currentUserID As String = ((CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName"), TextBox)).Text) insertSQL1 = "INSERT INTO Company (CompanyName, UserID) VALUES ('Company', 'currentUserID')"Dim cmd1 As New SqlCommand(insertSQL1, con) '2nd Command Data Dim selectSQL As String selectSQL = "SELECT companyKey FROM Company WHERE UserID = 'currentUserID'"Dim cmd2 As New SqlCommand(selectSQL, con) Dim reader As SqlDataReader '3rd Command Data Dim insertSQL2 As String insertSQL2 = "INSERT INTO Company_Membership (CompanyKey, UserID) VALUES ('CompanyKey', 'currentUserID')"Dim cmd3 As New SqlCommand(insertSQL2, con) 'First CommandDim added As Integer = 0 Try con.Open() added = cmd1.ExecuteNonQuery() lblResults.Text = added.ToString() & " records inserted."Catch err As Exception lblResults.Text = "Error inserting record." lblResults.Text &= err.Message Finally con.Close() End Try '2nd Command Try con.Open() reader = cmd2.ExecuteReader()Do While reader.Read() Dim CompanyKey = reader("CompanyKey").ToString() Loop reader.Close()Catch err As Exception lbl1Results.Text = "Error selecting record." lbl1Results.Text &= err.Message Finally con.Close() End Try '3rd Command Try con.Open() added = cmd3.ExecuteNonQuery() lbl2Results.Text = added.ToString() & " records inserted."Catch err As Exception lbl2Results.Text = "Error inserting record." lbl2Results.Text &= err.Message Finally con.Close()End Try
My requirement is that if the string in the column has any of the characters from 'ACDIPFJZ' , those characters have to be retained and the rest of the characters have to be removed.
I have a text field which has entries of variable length of the form:
"house:app.apx&resultid=1234,clientip" or "tost:app.apx&resultid=123,clientip" or "airplane:app.apx&resultid=123489,clientip"
I'm trying to pick out the numbers between resultid='...',clientip no matter what the rest of the string looks like. So in this example it would be the numbers:
1234 123 12389
the part of the string of the form resultid='...',clientip always stays the same except the length of the number can vary.
I'm a non-programmer and an SQL newbie. I'm trying to create a printer usage report using LogParser and SQL database. I managed to export data from the print server's event log into a table in an SQL2005 database.
There are 3 main columns in the table (PrintJob) - Server (the print server name), TimeWritten (timestamp of each print job), String (eventlog message containing all the info I need). My problem is I need to split the String column which is a varchar(255) delimited by | (pipe). Example:
2|Microsoft Word - ราย�ารรับ.doc|Sukanlaya|HMb1_SD_LJ2420|IP_192.10.1.53|82720|1
The first value is the job number, which I don't need. The second value is the printed document name. The third value is the owner of the printed document. The fourth value is the printer name. The fifth value is the printer port, which I don't need. The sixth value is the size in bytes of the printed document, which I don't need. The seventh value is the number of page(s) printed.
How I can copy data in this table (PrintJob) into another table (PrinterUsage) and split the String column into 4 columns (Document, Owner, Printer, Pages) along with the Server and TimeWritten columns in the destination table?
In Excel, I would use combination of FIND(text_to_be_found, within_text, start_num) and MID(text, start_num, num_char). But CHARINDEX() in T-SQL only starts from the beginning of the string, right? I've been looking at some of the user-defind-function's and I can't find anything like Excel's FIND().
Or if anyone can think of a better "native" way to do this in T-SQL, I've be very grateful for the help or suggestion.
I have a nasty situation in SQL Server 7.0. I have a table, in whichone column contains a string-delimited list of IDs pointing to anothertable, called "Ratings" (Ratings is small, containing less than tenvalues, but is subject to change.) For example:[ratingID/descr]1/Bronze2/Silver3/Gold4/PlatinumWhen I record rows in my table, they look something like this:[uniqueid/ratingIDs/etc...]1/2, 4/...2/null/...3/1, 2, 3/...My dilemma is that I can't efficiently read rows in my table, match thestring of ratingIDs with the values in the Ratings table, and returnthat in a reasonable fashion to my jsp. My current stored proceduredoes the following:1) Query my table with the specified criteria, returning ratingIDs as acolumn2) Split the tokens in ratingIDs into a table3) Join this small table with the Ratings table4) Use a CURSOR to iterate through the rows and append it to a string5) Return the string.My query then returns...1/"Silver, Platinum"2/""3/"Bronze, Silver, Gold"And is easy to output.This is super SLOW! Queries on ~100 rows that took <1 sec now take 12secs. Should I:a) Create a junction table to store the IDs initially (I didn't thinkthis would be necessary because the Ratings table has so few values)b) Create a stored procedure that does a "SELECT * FROM Ratings," putthe ratings in a hashtable/map, and match the values up in Java, sinceJava is better for string manipulation?c) Search for alternate SQL syntax, although I don't believe there isanything useful for this problem pre-SQL Server 2005.Thanks!Adam
Link ( GroupID int , MemberID int ) Member ( MemberID int , MemberName varchar(50), GroupID varchar(255) )
The Link table contains the records showing which Member is in which Group. One particular Member can be in multiple Groups and also a particular Group may have multiple Members.
The Member table contains the Member's ID, Member's Name, and a Group ID field (that will contains comma-separated Groups ID, showing in which Groups the particular Member is in).
We have the Link table ready, and the Member table' with first two fields is also ready. What we have to do now is to fill the GroupID field of the Member table, from the Link Table.
For instance,
Read all the GroupID field from the Link table against a MemberID, make a comma-separated string of the GroupID, then update the GroupID field of the corresponding Member in the Member table.
Please help me with a sql query or procedures that will do this job. I am using SQL SERVER 2000.
Hi,We have stored proc name proc_test(str nvarchar(30)). So far this prochas been invoked from a .NET application assuming that only Englishcharacter strings will be passed to it. The calls are likeproc_test('XYZ')We now have a requirement for passing Chinese strings as well. Ratherthan changing the calls throughout the application, we would like tohandle it in the stored procedure so that it treats the string as aunicode string. Can we apply some function to the parameter to convertit to unicode so that we don't have to call with an N prefixed to thestring?Thanks,Yash
There is a table t1 with two fields, such as, ID NAME 1 Tokyo 2 Xian 3 America
For there are full-width and half-width strings in the values of the two fields, I can not select and get the right records. So I want to transform the two fields ID and NAME, I fail to find the function in the SQL Server 2005. Please give me some advice.
In SQL 2000 DTS, I was able to append data from an ODBC source to a SQL 2000 destination table. The destination table was created by copying an attached source table in Access to a new table, then upsizing it to SQL. The character fields come over as varchar, and that seemed to be fine with the DTS job.
Now using the same source table and the same SQL destination, only in SQL 2005 with Integration Services instead of DTS, I get an error because the connection manager interprets the source text fields as Unicode and the destination fields are varchar.
I could script the table and change the text fields in the destination table to nvarchar, but this could have adverse affect on the application that uses the destination table. Is there a way to make the connection manager see the source text fields as varchar, or have the integration package allow the append even though the destination is varchar and the source is nvarchar?
I'm trying to figure out how to convert an INT so that I can add it to another string in a statement likeSELECT '<a href="http://mydomain.com/' + [IntValue] + '">' + [LinkName]Where [IntValue] is an INT field containing a folder number. I tried: TO_CHAR([IntValue, '999')but it didn't work. And I tried to find a TO_STRING function, but had no luck.Any advice to someone who is savy, but new to SQL Queries?
I have column data that looks like this:id | ColumnA---+-----------1 | 12,35,1232 | 1,233 | 233,34,354 | 34And I want to be able to make a WHERE clause where I can match up avalue to one of the values between the commas. I.e. each of the numbersbetween the commas are seperate values I wish to compare against.Is there any function, perhaps like VBScripts "Split" function, where Ican split those numbers up and compare a value against them?Perhaps there's another answer someone has?Example:If I'm searching with a value of "12" row 1 would be returned.If I'm searching with a value of "35", row 1 and 3 would be returned.--[ Sugapablo ][ http://www.sugapablo.com <--music ][ http://www.sugapablo.net <--personal ][ Join Bytes! <--jabber IM ]