Hello there i try to retrieve some data from my table but i cannot get it to get me the ItemID from the table
here is the connection string it jumps right at the start of the loop strconnection = New SqlConnection("Data source = REPORT-SRVR; Initial Catalog=Cincinnati_Tan_Company;Persist Security Info=True;User ID=basic_user;Password=ctc_user;")
Dim cmdstring As String = "select ItemID, Price FROM Office_Items WHERE Description ='" & item(INTINDEX) & "'" '
strconnection.Open()CMD = New SqlCommand(cmdstring, strconnection)
I receive the input file with some 100 columns and some 20k+ rows and I want to check the incoming input row is existed in the database or not based on 2 key columns. If the row is existed then I need to check all the columns (nearly 100 columns) values in input and the database are equal or not. If both are equal I need to treat them seperately if not there is a seperate logic. How Can I do that check for each row and for each column?
Basically the algorithm is like this, if the input file row is not existed in the database then treat that as new row else if the input row is existed in the database then check all the columns are equal or not. If all the columns are equal then treat that as existing row and do nothing else if some columns are not equal then treat this row seperately.
I found some thing to achieve the above thing. 1. Take the input row and check in the database. 2. If the row is not found in the database then treat it as new row. 3. If row is found in the database then a) Take the source row and prepare a concatenated string for all the columns b) Take the database row and prepare a concatenated string for all the columns c) Find out the hash code for the 2 strings and then compare hash codes for equal.
The disadvantage of this is running a loop 2*m*n times where m is the number of rows and n is the number of columns. It should be done 2 times for input file row and database row.
Can anybody suggest a good method to do this?
What does the function "GetHashCode" for InputBuffer in method "Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)" will do? Will it generates hash code based on all the columns values?
I have a stored procedure that selects the unique Name of an item from one table.
SELECT DISTINCT ChainName from Chains
For each ChainName, there exists 0 or more StoreNames in the Stores. I want to return the result of this select as the second field in each row of the result set.
SELECT DISTINCT StoreName FROM Stores WHERE Stores.ChainName = ChainName
Each row of the result set returned by the stored procedure would contain:
ChainName, Array of StoreNames (or comma separated strings or whatever)
Hi,I have a query like this :SELECTx1,x2,( SELECT ... FROM ... WHERE ...UNIONSELECT ... FROM ... WHERE ...) as x3FROM ...WHERE ...The problem is that I don't want to return the results where x3 isNULL.Writing :SELECTx1,x2,( SELECT ... FROM ... WHERE ...UNIONSELECT ... FROM ... WHERE ...) as x3FROM ...WHERE ... AND x3 IS NOT NULLdoesn't work.The only solution I found is to write :SELECT * FROM((SELECTx1,x2,( SELECT ... FROM ... WHERE ...UNIONSELECT ... FROM ... WHERE ...) as x3FROM ...WHERE ...) AS R1)WHERE R1.x3 IS NOT NULLIs there a better solution? Can I use an EXISTS clause somewhere totest if x3 is null without having to have a 3rd SELECT statement?There's probably a very simple solution to do this, but I didn't findit.Thanks
In the VB 2005 Express, I can get the SqlConnection and ConnectionString of a Database "shcDB" in the Object Explorer of SQL Server Management Studio Express (SSMSE) by the following set of code: ///--CallshcSpAdoNetVB2005.vb--////
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Public Class Form1
Public Sub InsertNewFriend()
Dim connectionString As String = "Data Source=.SQLEXPRESS;Initial Catalog=shcDB;Integrated Security=SSPI;"
Dim connection As SqlConnection = New SqlConnection(connectionString)
Try
connection.Open()
Dim command As SqlCommand = New SqlCommand("sp_insertNewRecord", connection)
command.CommandType = CommandType.StoredProcedure ....................................... etc. /////////////////////////////////////////////////////// If the Database "shcDB" and the Stored Procedure "sp_inertNewRecord" are in the Database Explorer of VB 2005 Express, I plan to use "Data Source=local" in the following code statements to get the SqlConnection and ConnectionString: ......................... ........................
Dim connectionString As String = "Data Source=local;Initial Catalog=shcDB;Integrated Security=SSPI;"
Dim connection As SqlConnection = New SqlConnection(connectionString)
Try
connection.Open()
Dim command As SqlCommand = New SqlCommand("sp_insertNewRecord", connection)
command.CommandType = CommandType.StoredProcedure ........................ etc.
Is the "Data Source=local" statement right for this case? If not, what is the right code statement for my case?
Hi all,I come up with a problem aleady discussed in some posts especially in the post http://forums.asp.net/t/1235761.aspx. but I got in not finally solved.The main problem is connecting to a database twice which causes errors. So I think this might be the right place to ask my questions. Here ist the problem in short:I'm using VWD on XP-Professional with SQL-Server Express and Reporting Services Express. All with Windwos Integrated Security and User Instance (SQLExpress). In my web-application I had for all Datasources the connect string:Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|mydatabase.mdf;Integrated Security=True;User Instance=True This works fine so far. I also have Reports designed with the Report designer using the same connection string. I can preview the reports and I deployd thre reports successfully. I want to call these report using a report viewer web control.Now the problem:when I call the remote remote report from my web-application, the database cannot be opened because an other process is using the database (see post mentioned above). It seems that this is a problem with attaching the database twice: from the sql-server and from the report-server.So I used now a new connection string without "attaching" the database (in vwd and in report designer):Data Source=.SQLExpress;Initial Catalog=C:inetpubwwwrootmyappAPP_DATAmydatabase;Integrated Security=True Now everything works...but ... only on my machine. On the production machine this does not work. I wonder anyway, why its working on my machine, because I never "attach" the database (there is no connection string with AttachDbFilename and I have not opend the developer and have not opened the sql management studio).On the production machine the concurrent (SQL-Server and Report-Server) connection to database does not work with either connection strings, no matter if i attach the database with sql server manager or not).This all drives me crazy for days now. All I want is to use SQL-server and Reporting- Services with its nice features and not repairing my tools. I thought I have a standard Installation, nothing special, but the standard obviously makes problems.Here finally my question:Does this environment ( web-application with remote reports) with Express edition cause normally no problems?Can I "attach" a database only once? How should I connect with my web application that uses the sql-server connections and also the report-server-connections (attaching twice does not work).What connection strings to use and when (AttachDbFilename or Initial Catalog).Are these problems specific to the Express Editions? I thank you in advance for any help Dieter
Hi all. I need to create a select query in my program that will select from a list of values that are stored in a dataset. Let see this example: selectcmd = "Select * from mytable where myfile =" ??????? cmd = New SqlCommand(selectCmd, da.SelectCommand.Connection)
The values I need to put on ????? are stored in a dataset. For example if the dataset is populated with the following values: A B C D E
I would like to build a query like that: selectcmd = "Select * from mytable where myfile = ‘A’ or ‘B’ or ‘C’ or ‘D’ or ‘E’ “
I'm building a textbox with search functionality towards SQL 2000. The textbox is to include various search phrases, like "phrase1 phrase2 phrase3". Sort of like search engines where all words are considered. Do keep in mind that it's SQL2000 and not 2005. I've got all the strings I want to perform the search against in one column but various values in this column. The only thing I've come up with is to create "WHERE columnName LIKE @phrase1 OR columnName LIKE @phrase2" where I inject % as apropiate and chop up the string, but I'm hoping this is not the solution because it doesn't seem really clean (with 10 search words) and today I'm not having a 'bad-hack' day so I want it better. Whats is the best way of doing this? Cheers! /Eskil
I have a table wih multiple records and some has common values. For example, new child row need to inherit some of parent's data. Here is how I want to do: Select [parent data1], [parent data2] from [TABEL] where id = parent Insert INTO [TABLE] ([child id], [child data1], [child data2] ) VALUES [child id] [parent id] [parent id]........... I was thinking about using Selected and Inserting events but not sure how. Please help? Thanks,
I need a query that will RETRIEVE a value from a database if it is present, but if the data isn't present, then the data will be INSERTed into the table.
Either way, I need the row returned at the end of the query.
I can do SELECT queries, but I don't have a clue as to how to proceed with branching statements.
For example:
User runs a query for "Canada". Canada exists in the database, so the database returns Canada along with its ID.
Next user runs a query for "Chile". Chile isn't in the database so a record is created and the ID (an IDENTITY field) is returned.
I have a table which has 4 fields, patientid,testdate,testtype,results. I want to select the most recent testdate by a patient regardless of the results, or the testtype. I do however need those fields for my query. I tried the below, but I get more than 1 record if the person has had two different types of tests. For instance if patient 100 has the following 2 records I just want the most recent
patientid testdate testype results
100 01/02/2002 TBI ASYMP 100 02/02/2001 PPD 00000
select max(testdate)as testdate,testtype, other_id_number from vw_cms_tb_lasttest
What am missing? Thanks group by other_id_number,testtype order by other_id_number,testtype
set @bcpcommand = 'bcp "select med + replicate('' '',10-datalength(med)),ml+ replicate('' '',20-datalength(ml)),iname + replicate('' '',10-datalength(iname)) from copy_tbl" queryout "'+ @filename + '" -U -P -c'
exec master..xp_cmdshell @bcpCommand
Some of the values in the select statement are Null values and are getting skipped in the text file .My output looks like At A02 At1E AtE A03 At2E c100 c1230 I want them to allign but the third row has a null in the middle so it skips it and put the third value in the seconds place
I am running a select statement against a function that is giving me different values depending on how it is called. When I run it through sql server management studio, I get the proper results, the default value column has the parameters default value. When I call it through my web app, I get this in the default value column: *** ERROR OCCURRED level 2 (this is not a default value) ***
Why would the same sql statement get different results?
Here is the call: select * from dbo.f_GetSProcParameters('webservices_BENEFICIAL_USES_DM_SELECT')
Here are the two functions: --------------------------------------------------- USE [si_training_db] GO /****** Object: UserDefinedFunction [dbo].[f_GetSProcParameters] Script Date: 06/13/2008 09:29:21 ******/ SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER ON GO
ALTER function [dbo].[f_GetSProcParameters](@StoredProcedureName VARCHAR(128) )
/* * DESCRIPTION : This function returns a table listing all the parameters of a stored *procedure and the default values of those parameters. * * RETURNS : table * * * ORIG AUTHOR : Josh Kinder * DATE WRITTEN : 3/14/2006 * * REVISIONS LOG * *ID/Date PC# Description *------- --- ---------------------------------------------------------- */
Insert Into @ParmTable Select a.Name From SysColumns a Inner Join SysObjects b On b.Id = a.Id Where b.Name = @StoredProcedureName
Select @Count = Count(Id), @Index = 1 From @ParmTable
While (@Index<=@Count) Begin
Select @CurParm = ParmName From @ParmTable Where Id = @Index
Set @DefaultVal = dbo.f_GetsProcParamDefaultValue(@StoredProcedureName, @CurParm)
SELECT@IsInput = CASE WHEN params.is_output = 1 THEN 0 ELSE 1 END FROMsys.procedures AS procs INNER JOINsys.all_parameters AS params ON params.object_id = procs.object_id LEFT JOINsys.types AS types ON types.system_type_id = params.system_type_id AND types.user_type_id = params.user_type_id WHEREprocs.is_ms_shipped = 0 AND params.name = @CurParm AND procs.name = @StoredProcedureName
Insert Into @sProcParameters ( ParmName, DefaultValue, HasDefault, IsInput ) Values ( @CurParm, @DefaultVal, Case When @DefaultVal = 'NoDefaultExists' Then 0 Else 1 End, @IsInput )
Set @Index = @Index + 1 End
ScriptErr: Return
End
--------------------------------------------------- USE [si_training_db] GO /****** Object: UserDefinedFunction [dbo].[f_GetsProcParamDefaultValue] Script Date: 06/13/2008 09:30:07 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO
ALTER function [dbo].[f_GetsProcParamDefaultValue] ( @StoredProcedureName VarChar(128), @ParamName VarChar(128) )
ReturnsVarChar(128)
/* * DESCRIPTION : This function returns a table listing all the parameters of a stored *procedure and the default values of those parameters. * The following copyright info is for the parsing algorithm to get the default value. I obtained the code from SQL Farms Solutions and their only stipulation for use is that the copyright info remain with the code. Although I customized it for us, it is still their algorithm.
-- Check that the parameter name is valid for the proc If Not Exists( Select 1 From INFORMATION_SCHEMA.PARAMETERS Where SPECIFIC_NAME = @StoredProcedureName And PARAMETER_NAME = @ParamName ) Begin Set @ParameterDefault = '*** ERROR OCCURRED level 1 (this is not a default value) ***' Goto ScriptErr End
/*----------------------------------------------------------------------------------------------------------------------------------*/ --Get sProc into a workable temporary table /*----------------------------------------------------------------------------------------------------------------------------------*/
Insert Into @ProcContent Select Value From dbo.f_Split(@CurText, @Delimiter, 1, 0)
-- Make sure that some rows were returned successfully If @@ROWCOUNT = 0 Begin Set @ParameterDefault = '*** ERROR OCCURRED level 2 (this is not a default value) ***' Goto ScriptErr End
/*----------------------------------------------------------------------------------------------------------------------------------*/ --Get location of parm and get ready to parse /*----------------------------------------------------------------------------------------------------------------------------------*/
-- Get the first line where the parameter is referenced in the proc code. -- (the LIKE here is a little complex since it is possible that multiple parameters -- will start with the same string. Most cases of interest are covered by the -- conditions listed below). Select @minRow = Min(Idx) From @ProcContent Where ProcText Like '%' + @ParamName + ' %' Or ProcText Like '%' + @ParamName + Char(9) + '%' Or ProcText Like '%' + @ParamName + Char(10) + '%' Or ProcText Like '%' + @ParamName + Char(13) + '%' Or ProcText Like '%' + @ParamName + '=%' Or ProcText Like '%' + @ParamName + '%=%' Or ProcText Like '%' + @ParamName + ',%'
-- Check that the parameter is referenced in the code If @minRow Is Null Begin Set @ParameterDefault = '*** ERROR OCCURRED level 3 (this is not a default value) ***' Goto ScriptErr End
-- Get the proc line where the word 'AS' is declared. 'AS' is required -- upon proc creation to complete the variable declaration. -- Note: This cover most cases of interest. There could be scenarios where -- additional condition should be applied. Select @maxRow = Min(Idx) From @ProcContent Where ProcText Like '% AS' Or ProcText Like '% AS ' Or ProcText Like '% AS' + Char(9) Or ProcText Like '% AS' + Char(10) Or ProcText Like '% AS' + Char(13) Or ProcText Like 'AS %' Or Upper(RTrim(LTrim(ProcText))) = Char(10) + 'AS' Or Upper(RTrim(LTrim(ProcText))) = 'AS' Or Upper(RTrim(LTrim(ProcText))) = 'AS' + Char(10) Or Upper(RTrim(LTrim(ProcText))) = 'AS' + Char(13) Or Upper(RTrim(LTrim(ProcText))) = 'AS' + Char(13) + Char(10) Or Upper(RTrim(LTrim(ProcText))) = 'AS' + Char(10) + Char(13)
-- Check that the 'AS' string was found successfully If @maxRow Is Null Begin Set @ParameterDefault = '*** ERROR OCCURRED level 4 (this is not a default value) ***' Goto ScriptErr End
/*----------------------------------------------------------------------------------------------------------------------------------*/ --Parse and get the default value /*----------------------------------------------------------------------------------------------------------------------------------*/
-- Get the first proc line of code where the parameter is referenced, for string processing, -- and append to it all proc rows until the 'AS' string Select @tmpText = LTrim(RTrim(Replace(Replace(ProcText, Char(10), ''), Char(13), ''))) + ' ' From @ProcContent Where Idx = @minRow
While @minRow < @maxRow Begin Set @minRow = @minRow + 1
Select @tmpText = @tmpText + ' ' + LTrim(RTrim(Replace(Replace(ProcText, Char(10), ''), Char(13), ''))) + ' ' From @ProcContent Where Idx = @minRow End
-- Find the position of the parameter name. Delete all text before that position. Set @tmpInt = Null Set @tmpInt = PatIndex('%' + @ParamName + '%', @tmpText) - 1 Set @tmpText = Right(@tmpText, Len(@tmpText) - @tmpInt)
-- At this point we are nearly done: -- We check whether the character '=' comes before the 'AS' or ',' string -- If not- the parameter has no default value. -- If so, we continue to find the value of the default parameter
Set @tmpCharPos1 = PatIndex('%=%', @tmpText) Set @tmpCharPos2 = PatIndex('%,%', @tmpText) Set @tmpCharPos3 = PatIndex('% AS %', @tmpText)
If @tmpCharPos1 <= 0 Or (@tmpCharPos1 > @tmpCharPos2 And @tmpCharPos2 > 0) Or (@tmpCharPos1 > @tmpCharPos3 AND @tmpCharPos3 > 0) Begin -- The column does not have a default Set @ParameterDefault = 'NoDefaultExists' End Else Begin -- Column has a default and it is left to find it. -- First chop the string until the '=' character Set @tmpInt = NULL Set @tmpInt = PatIndex('%=%', @tmpText) - 1 Set @tmpText = LTrim(Right(@tmpText, Len(@tmpText) - @tmpInt))
-- Now, we p*** the remaining string until we get a ',' or a ' ' character Set @tmpCharPos1 = NULL Set @tmpCharPos2 = NULL
Set @tmpCharPos1 = PatIndex('%,%', @tmpText) Set @tmpCharPos2 = PatIndex('% %', @tmpText)
Set @tmpInt = NULL
If @tmpCharPos2 > @tmpCharPos1 AND @tmpCharPos1 > 0 Set @tmpInt = @tmpCharPos1 - 1 Else Set @tmpInt = @tmpCharPos2 - 1
If @tmpInt <= 0 Begin Set @ParameterDefault = '*** ERROR OCCURRED level 5 (this is not a default value) ***' Goto ScriptErr End
Set @ParameterDefault = SubString(@tmpText, 1, @tmpInt)
-- If the parameter default is a string, then we will have an '' at each side of it. -- These last lines of code will get rid of the ''. If Len(@ParameterDefault) >= 1 If Right(@ParameterDefault, 1) = '''' Set @ParameterDefault = Left(@ParameterDefault, Len(@ParameterDefault) - 1)
If Len(@ParameterDefault) >= 1 If Left(@ParameterDefault, 1) = '''' Set @ParameterDefault = Right(@ParameterDefault, Len(@ParameterDefault) - 1) End
I have a problem when selecting distinct values from a table. I want to select those distinct numbers with a code that I want. To make it more clear i`ll show it on an example.I have the following table:
I am new to SQL and I am trouble-shooting a problem with a home-grown app someone else wrote using PERL. It has a web interface with names of boards. I found the program where i need to add the board names into and did that. The new board names show up in the drop-down list in the Web page for the app. Alerts are sent to the new board names and show up on the new boards. Users are granted access to the new boards and they can clear items off the new boards. Yet when i try to use a report function for the new boards i added, nothing is returned. I even ran a simple SQl select statement specifying the new board names and nothing is returned. The older board names, some of which i added myself, return values. I don't know what is going on. Any help is appreciated.
Hello,I need to select the minimum between the result of a function and anumber, but i can't find a smart way. By now I'm doing like thefollowing, but I think is very expensive because it evaluates thefunction twice:select case when (myfunction())<100 then (myfunction()) else 100 endAny idea is appreciated.Thank youRegards--elimina carraro per rispondere via email
I am new to sql query and have a question.I would like to display row column values as column names.questions table consisted ofquestion_id, group_id, questionresponse table consisted ofresponse_id, group_id, question_id, answerI would like to display the answer responses under the columns ofquestions : such asresponse_id, question(1), question(2), question(3)...It will be greatly appreciated if someone help me to get this down.Jason
I am very new to web development using Microsoft Visual Studio. (my primary expertise is Framemaker 2003). I am currently going through your ASP.NET 2.0 videos and reproducing the lesson content on my development system. I have Microsoft Visual Studio 2005 Professional Edition. I also have Microsoft SQL Server 2005, Microsoft SQL Server 2000, Microsoft .NET Framework SDK v1.1 and Microsoft .NET Framework SDK v2.0. I seem to be having difficulties with the SQL interface because when I try to use the Property object from Lesson04, I get System.Web.HttpExceptioon {"Unable to connect to SQL Server database."}. When I subsequently tried to Add New Item - SQL Database from Lesson08, I get a Microsoft Visual Studio error box "Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly. Please verify the installation of the component or download from the URL: http://go.microsoft.com/fwlink/?LinkId=49251" Any ideas? I know the videos are based on use of the Microsoft Visual Studio Express -- are there significant configuration differences between it and Microsoft Visual Studio Professional that would make these lessons incompatible?
Using web dev and sql 2005 express I have published web app and database to my server but can,t get connection string to connect with the database. --------------------------------------------------------------------- Login failed for user ''. The user is not associated with a trusted SQL Server connection. 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.SqlClient.SqlException: Login failed for user ''. The user is not associated with a trusted SQL Server connection. --------------------------------------------------------------------- I have created a user in the logins in the sql server security node and give him every permission going. I have also created a login in the security node for the database..... and given him all permissions But I still can,t get the connection string from the web app to connect to the database? Where am I going wrong
Hi all, I am new to this field. I am trying to Connect to the database using the following code. The code does not give an error but gives an empty grid view. Can somebody figure out the mistake?protected void Page_Load(object sender, EventArgs e) {if (!IsPostBack) BindGridView(); }void BindGridView() { System.Data.SqlClient.SqlConnection sqlconnect = new System.Data.SqlClient.SqlConnection("");//added connection string here String command = "SELECT * from table";System.Data.SqlClient.SqlCommand sqlcommand = new System.Data.SqlClient.SqlCommand(); sqlcommand.CommandText = command; sqlcommand.Connection = sqlconnect;System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(); da.SelectCommand = sqlcommand;DataSet ds = new DataSet(); sqlconnect.Open(); sqlcommand.ExecuteNonQuery(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); sqlconnect.Close(); }
I have a file called upload.vb and I am having a lot of trouble figuring out how to connect to a database that I have created in my App_Data folder called myDatabase.mdf. Here is the code on for upload.vb Imports System Imports System.Data Imports System.Configuration Imports System.Web Imports System.Web.Security Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.WebControls.WebParts Imports System.Web.UI.HtmlControls Imports System.IO Imports System.Data.SqlClient
Public Class Upload Implements IHttpHandler, IReadOnlySessionState
Public Sub New() End Sub
#Region "IHttpHandler Members"
Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable Get Return True End Get End Property
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
If context.Request.Files.Count > 0 Then ' get the applications path Dim tempFile As String = context.Request.PhysicalApplicationPath ' loop through all the uploaded files Dim j As Integer = 0 While j < context.Request.Files.Count ' get the current file Dim uploadFile As HttpPostedFile = context.Request.Files(j) ' if there was a file uploded If uploadFile.ContentLength > 0 Then
End If System.Math.Max(System.Threading.Interlocked.Increment(j), j - 1) End While End If ' Used as a fix for a bug in mac flash player that makes the ' onComplete event not fire HttpContext.Current.Response.Write(" ") End Sub
#End Region
End Class Everytime I attempt to create a database connection I get all kinds Compiler errors. If anybody can help me understand how to connect to my database from this page I would greatly appreciate it. Thanks.
I am new to the visual web development program; however, I have created many applications using Visual Studio Express in Visual Basic. I am trying to figure out how to:1. Define a connection string in VB2. Open a current Connection3. Define a SqlStatement4. Retrieve the information5. Display results in textboxI am basically trying to get a login system set up so that a user can type in his name and password and is then directed to a secure page.When I create a new application and want to do this I would use the following code: Dim cnUsers As New SqlClient.SqlconnectionDim cnUsersString As String = "CONNECTION STRING"Dim UserCommand As NEw SqlClient.SqlCommand = "Select chrUsers, chrPassword FROM tblUsers WHERE chrUsers = '" & txtUserName.Text & "' AND chrPassword = '" & txtPassword.Text & "'" cnUsers.ConnectionString = cbUsersStringcnUsers.Open()UserCommand.Connection = cnUserstxtResults.Text = cnUsers.ExecuteNonQuery()cnUsers.Close() That is a very rough draft of what I would code it as. If you have any suggestions please let me know! - NUStudent-
I have an SQL database setup but i don't know how to connect to it to set up a table. I have a vague idea about connectionstrings and such. I have a server name, a database name, a user id and a password. I would like to set it up so i can just enter the SQL commands and create a table and enter data. But first I need to connect to the database. I
I am moving my site from a shared environment to a dedicated server and SQL is on the same box. How do I connect to my database if it's on the same box?
Please help me with the following problem because I am running around in circles.
I have this problem getting a forum online. Since it is a database related problem which I have been trying to solve at the ClubSite forum I am taking the liberty to come to this forum with this problem.
This is the story: I have this separate SQL database dotForum2004.mdf in App_data. After trial and error got it working locally.
But when I put it online at my webserver (On a Stand-alone PC at my jobsite) I get an application error.(From the Club Site application)
This is the connection key which works fine locally. Is there something obvious you can point me at?
For an assignment at school, I need to build an ASPX web page that looks up books in a database. This entails the use of a SQL database, and I am having issues trying to connect to the database.
here is a pic of the error I am getting:
I am using Visual WebDeveloper 2005 Express to do this in, and I can't find any options that pertain to the error above. I looked in the SQL configuration tools that I have installed, and I can't seem to find the correct options that I need.
Does anyone know how to resolve this? If you can provide direction on this, that would be great.
Hi. I'm totally new here, and I'm not an expert when it comes to SQL, so bear with me. This is my dilemma:
I use Access 2000 to connect to my Microsoft SQL Server 2000 database. Recently, our provider switched us from a shared server to a dedicated server. The site is up and running perfectly, but I can't connect to my database via Access anymore. Once I received the new location of the database, I ran odbcad32.exe and configured the database's DSN info where appropriate. I run the "Test Data Source..." function and the tests are seemingly successful. When I open my database using Access, I'm able to log in successfully, but when I click on any one of my linked tables, I get the following error:
Could not execute query; could not find linked table.
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'NAMEOFDATABASE.NAMEOFTABLE'. (#208)
The support team at my provider are not exactly geniuses, so who knows if and when they'll be getting back to me. In the meantime, does anyone have a clue what might be causing this? Since the site is working perfectly, I assume the connection strings are okay and the database is perfectly intact (I even checked to see that the most recent entries were live), so what gives? If there's any more info I can provide, let me know. Thanks in advance.
Hi, I will post this on a c# forum as well but maybe someone has an answer here.
I want to connect to my database in a program i am coding with C#. I have 3 databases in my SQL server (DB1, DB2, DB3)(perhaps schemas is the word to use) all under a connection called TEST (as opposed to SQLEXPRESS.
My connection string in my code is as follows: string ConnectionString = "Data Source=.\TEST;Integrated Security=True;Connect Timeout=30;User Instance=True;";
My app reports a valid connection is made. WooHoo. But, When i try to do a select statement eg: Select * from DB1.Customers I get the following error. System.Data.SqlClient.SqlException: Invalid object name 'DB1.Customers'
I have tried removing the DB1. part from the select statement and specifying Database = DB1 in my connection string but that doesnt work either.
i have to give connection string in .cs file as SQLConnection cn=new SQLConnection("")
i have to connect to local computer..please anyone provide me solution. datbase is northwind...and i m connected it with windows authentication.. please any one provide me answer....
I'm completely new to this, so as much detail as you can provide is appreciated.
I have a SQL database called "WebDesk.mdf" and I have a ASP.Net web application. I can't figure out the connection string I need to connect to this database. It doesn't matter if I connect to it as a file, or otherwise.
Please tell me all the steps I need to get the connection string.