Connecting Variable To Database Field

May 10, 2007



Greetings

what I need to do is access tables in a database, clean up one of the fields and return it to another table in the database. Im using a script component for the transformation whick looks for , or : and replaces : with a decimal point and removes the comma completely. My problem comes with the varaible-- how do I set this up so that the variable read matches the field in the database??



here is the script itself

thanks

km



Public Function AddList(list As String) As String
Dim total As Double
total = 0

If Len(list) > 0 Then
Dim s As Object
s = Split(list, ",")

Dim i As Integer
For i = LBound(s) To UBound(s)
s(i) = Replace(s(i), ":", ".")
total = total + CDbl(s(i))
Next
End If

AddList = total
End Function

View 3 Replies


ADVERTISEMENT

1 DB Field Not Connecting, Others Do

Apr 22, 2008

HI,
I have a Access DB attached to a SQL server using the ODBC connection on our "idrive" and everything works. All the queries (about 30) work, but there 1 one that always gets a [call failed error saying....select permissions denied, on obj "email copies", db "ILL", owner "dbo" (#229). This is the only query that pulls from that table element.

What I'm not understanding is why only 1 Table field element can have trouble when all the others work fine. My supervisor can get it just fine on his PC. I remember saying "yes" to block unsafe expressions, but I went to the macros and reversed that setting.

Has this ever happened to anyone else?

View 1 Replies View Related

Aggregate Function In Chart Data Field When Connecting To Cube

Oct 11, 2007

SSRS/SSAS. I'm using aggregate function no problem in a Table, but when I try to use same function in data field of a chart I get no results. I know that "aggregate" has only been supported since SP2, is there a known problem with using it in charts?

Thanks
Richard

View 1 Replies View Related

Variable In A Field

Sep 6, 2004

Could anyone tell me why this isn't working, or if it simply can't be done.

DECLARE @x varchar
SET @x = 'ITEMNMBR'

SELECT *
FROM IV00101
WHERE @x between '3530001' and '3530020'

View 4 Replies View Related

Passing A Column/field Name As A Variable?

Aug 24, 2005

Is it possible to use a table's fieldname as an SQL variable?

i.e. can the below be made to somehow work:


Code:

SELECT Firstname, Surname, myVariable
FROM ContactDetails
WHERE myVariable = [user input];



- or simply -


Code:

SELECT Firstname, Surname, [user input]
FROM ContactDetails;



---
The "user input" being any other chosen column/fieldname from the ContactDetails table (e.g. Street, City, Postcode, etc.).

i'm using Access and ASP - in case that makes a difference.

any help would be greatly appreciated.

View 1 Replies View Related

Append Counter Variable To Field Name

Jun 14, 2004

Hi all,

I have a table with fields name Days1, Days2, Days3 - I am trying to use a loop in conjunction with a counter to identify each of these fields - I can't quite get the correct syntax and it is driving me crazy!!!

Here's the proc:

WHILE @Counter < 4
BEGIN

SELECT @AppointmentsCount = COUNT(tbl_SurgerySlot.SurgerySlotKey)
FROM tbl_SurgerySlot INNER JOIN
tbl_SurgerySlotDescription ON tbl_SurgerySlot.PracticeCode = tbl_SurgerySlotDescription.PracticeCode AND
tbl_SurgerySlot.Label = tbl_SurgerySlotDescription.Label LEFT OUTER JOIN
tbl_Appointment ON tbl_SurgerySlot.SurgerySlotKey = tbl_Appointment.SurgerySlotKey AND
tbl_SurgerySlot.ExtractDate = tbl_Appointment.ExtractDate
WHERE (tbl_SurgerySlot.ExtractDate = @ExtractDate) AND (tbl_Appointment.AppointmentKey IS NULL) AND
(tbl_SurgerySlot.StartTime > @DateFrom) AND (tbl_SurgerySlot.StartTime < @DateTo) AND (tbl_SurgerySlotDescription.IsBookable = 1)

SET @FieldName = 'Days' + CONVERT(VARCHAR(20),@Counter)

INSERT INTO tmp_Availability (@FieldName)
VALUES (@AppointmentsCount)

SET @DateTo = DATEADD(Day,1,@DateTo)

--Increment the loop counter
SET @Counter = @Counter + 1

When I run the above the follwoing message is displayed:

Server: Msg 208, Level 16, State 3, Line 36
Invalid object name 'tmp_Availability'.

The object IS valid so I'm lost....

View 8 Replies View Related

Variable As Field Name In CURSOR FOR UPDATE

Dec 10, 2005

I'm trying something like:

UPDATE tbl SET @varFieldName = @varValue

The procedure runs, and when I PRINT @varFieldName, it looks fine, but the table isn't getting updated, and no errors, wierd.

I have the CURSOR open for update, but I didn't list the field names, that shouldn't be a problem, as all fields should be updateable then.

To get the field name, I :

SET @varFieldName = 'SomeChars' + LTRIM(STR(asmallint)) + 'SomeMoreChars'

Thanks,
Carl

View 2 Replies View Related

Running Date Variable On One Field

Sep 19, 2014

I have two tables that I am pulling data from: an item table and a sales table. Almost all of the information comes from the item table (item description, location, amount on hand). The last field wanted is Year-To-Date sales. I can pull the sales field from the sales table, which gives me all sales from the creation of the db. I need to be able to run a date variable of This Year on that sales field only. I have a date field I can reference off of in the sales table.

View 6 Replies View Related

How To Add Variable To Sql Command Text Field

Sep 7, 2007

In the data flow task I have multiple OLE DB source task to retreive data from a cube using MDX. Below is an example of the query from sql command text field: I have a few questions on how to modify this statment to make it more robust.

1) The where clause [Calendar].[Quarter 2 (2007)] should actually be some kind of variable that will change each time
the user runs this project. So I am wondering how to make this a variable and get it into this field.

2) I had thought that I could use the SSIS variable. I have created one, but I can not figure how to get it into the field that
contains the given select statment.

3) I believe that once I get this variable part to work then I want a way to have user set this data value. Either by selecting data from a table in database or through a user interface where user enters data. I did do some resarch on creating a user interface, but I did not understand what I had to do, so if any one knows where to find a tutorial on how to do this let me know, or what they believe the best/easiest way is to get data from user to fill this where clause.
select * from OPENROWSET('MSOLAP', 'DATASOURCE=local; Initial Catalog=Patient Demographics 2005;',
'with member [Measures].[TimeDisplayName] as [Calendar].CurrentMember.Name
SELECT NON EMPTY { [Measures].[TimeDisplayName],[Measures].[Adjusted Relative Weight],[Measures].[Adjusted Case Weight]} ON COLUMNS,
({[Facility].[REGION].[NATCODE], [Facility].[REGION].[REGCODE]} *
[RIC].[CMGGRPCD].ALLMEMBERS) ON ROWS FROM [ESR]
WHERE [Calendar].[Quarter 2 (2007)]
')

View 10 Replies View Related

Passing An Array And/or Variable Field Name To An SProc

Jul 20, 2005

I have 2 questions.I am trying to write a stored procedure to update a table. I am tryingto pass a variable that represents the name of the column/field andanother for the value that I am changing.For example:@FieldName VARCHAR(100)@FieldValue VARCHAR(100)ASUPDATE tblTHETABLESET @FieldName = @FieldValueFirst is it possible to use a variable as the column/field name? Ifso, how do I go about it?Also, it would be nice if I could have the @FieldName and @FieldValuevariables as arrays. Is that possible?Thank-you for any assistanceBill

View 2 Replies View Related

How To Calculate The Size Of A VARBINARY(max) Field Or Variable

Jan 7, 2008



How can i do the following:


Calculate the size of a varbinary(max) field or variable

Calculate the average of a varbinary(max) table column
I am using SQL 2005
Thanks for your posting

View 3 Replies View Related

Can I Use A Variable In The Attachments Field On A Send Mail Task?

Dec 12, 2007

I need to email a report that contains a date in the report name. Can I build the file name with script and use a variable in the attachments field on the send mail task. Any advice or suggestions would be appreciated.

View 1 Replies View Related

Right Code Statements Of SqlConnection &&amp; ConnectionString For Connecting A Database In Database Explorer Of VB 2005 Express?

Feb 14, 2008

Hi all,

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?

Please help and advise.

Thanks,
Scott Chang

View 6 Replies View Related

Limit On SSIS String Variable Size, Trying To Get Big Xml File Into Xml Data Field

Nov 28, 2007

I have a SSIS package that opens an xml file, puts the contents into a string, then runs a stored procedure that dumps it into an xml column in a table. One of the xml files is huge. Putting the data into a ssis string causes an error. The length of the string variable is 58,231,886. The file will only get bigger.

How else can I get this data into a SQL Server XML field.

View 1 Replies View Related

Connecting To A Database Twice Fails Because Database Is Uses By An Other Process

Apr 23, 2008

 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

View 2 Replies View Related

Connecting To SQL Database?

Sep 24, 2007

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?

View 10 Replies View Related

Connecting With Database

Sep 26, 2007

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
 

View 5 Replies View Related

Connecting To The SQL Database

Nov 21, 2007

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();
}

View 8 Replies View Related

Connecting To An SQL Database

Mar 9, 2008

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

''' <summary>
''' Upload handler for uploading files.
''' </summary>
'''

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

uploadFile.SaveAs(String.Format("{0}{1}{2}", tempFile, "Uploads", uploadFile.FileName))

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.

View 2 Replies View Related

Connecting To Database Using VB

Jun 19, 2008

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- 

View 2 Replies View Related

Connecting To A Database

Nov 19, 2005

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

View 1 Replies View Related

Connecting To SQL Database

Nov 29, 2005

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?

View 4 Replies View Related

Connecting To SQL Database

Apr 25, 2006

Hi all,
 
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?
 
<add key="forumDSN" value="Provider=SQLOLEDB; Server=.SQLExpress;AttachDbFilename=|DataDirectory|dotForum2004.mdf;Trusted_Connection=Yes;" />
 
Thanks in advance,
Lex

View 5 Replies View Related

I Need Help With Connecting To A SQL Database...

May 2, 2007

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.

View 3 Replies View Related

Help Connecting To SQL Database

May 2, 2004

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.

View 6 Replies View Related

Connecting To Database With C#

Jun 2, 2008

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.

Any help provided would be greatly appreciated.

Thanks.

View 2 Replies View Related

Connecting To Database

Sep 17, 2007

hi,

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....

View 5 Replies View Related

Connecting To SQL Database With VB.net

Feb 20, 2008

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.

-Dan

View 3 Replies View Related

Creating Database From Stored Proc With Variable Holding The Database Name

Aug 16, 2007

Here is my code


ALTER PROCEDURE Test
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

DECLARE @From varchar(10)
DECLARE @To varchar(10)
DECLARE @DBName varchar

SELECT TOP 1 @From = CONVERT(char,CreateDate,101) FROM CustomerInfo
WHERE TicketNum =
(SELECT TOP 1 TicketNum FROM CustomerInfo
WHERE CreateDate <= DATEADD(mm, -30, CURRENT_TIMESTAMP)
ORDER BY CreateDate DESC)
SELECT @To = CONVERT(char,GETDATE(),101)

SET @DBName = 'Archive_SafeHelp'
CREATE DATABASE @DBName + ' ' + @From + ' ' + @To
END


I am trying to create a database based on the name contained in the variables. I get the error 'Incorrect syntax near '@DBName'. How do i accomplish this?

Thanks
Ganesh

View 2 Replies View Related

Help With Connecting To SQL Database And Binding

Jun 30, 2006

I am new to .net and I am using Visual Web Developer 2005 Express with SQL Server 2005 Express.  What I would like to do is connect to my SQL database (which resides in the app_data folder) and open a table and pull out a field and place it in either a textbox or label on the page. No editing or deleting. Just simple one field binding.  By the way, I can do this with all the cool built-in tools of VWD, but I want to know how to do it all by hand.  I would really appreciate it if someone could help me out.

View 3 Replies View Related

Having Trouble Connecting To Database

Aug 19, 2006

Hi I am new at this.   
I have a little program written in C# in asp.net.  The program basically accesses a database and stores new records.  The database is supposedly already attached to MSDE so I am able to see the tables of the database inside asp.net.   I can click on the individual slots of the table and modify the datas manually.  However, I want to connect to the database from my C# program and be able to input data into the database via the website that the C# program produces.  After I type in the data into the website and click the submit button on the website, I get an error page that says this:
Login failed for user 'sa'
the line of code thats causing this error is:
con = new SqlConnection("data source=(local)\NetSdk; initial catalog=Friends; user id=sa");
Why is it not able to connect to the database?

View 2 Replies View Related

Connecting To Remote Database?

Feb 3, 2007

I am using SQL Server 2000 database in my VB.Net project.
My VB.net application is installed one two machines in different cities i.e. there are two separate databases.
First machine's IP address is say 202.33.44.55 and other machine IP address is say 203.33.55.66. Now I want to use each others databases i.e. I want to set their database group.
So that in my VB.Net's application which is installed on 202.33.44.55 I could see data of the 203.33.55.66 by just changing the connection string

View 9 Replies View Related

Having Some Trouble Connecting To A Database....

Feb 13, 2007

I am doing one of the Microsoft virtual labs "Creating ASP.NET Web Applications with C# - Part 2" using Visual Web Developer Express. I am trying to fill a gridview with database information, but it gives me the error "An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)".This is on the local machine that I am executing the code.  public void BindGrid(string sortfield)
{
//Create DataAdapter to fetch data from Prodcuts table
SqlDataAdapter myCommand = new SqlDataAdapter("select * from Products", myConnection);
//Create dataset and fill it with Product data
DataSet ds = new DataSet();
myCommand.Fill(ds, "Products");
//Bind Product data to Datagrid
DataView Source = ds.Tables["Products"].DefaultView;
Source.Sort = sortfield;
dgProducts.DataSource = Source;
dgProducts.DataBind();
} It stops on the line "myCommand.Fill(ds, "Products"); and points out the error mentioned earlier. I am not sure what to do...any help would be greatly appreciated, thanks in advance, and I apologize as well if I have not pointed out enough information.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved