I think There are several ways of doing this but of which i pretty much sure about is running your sql server instance on a server with Static IP. You also need to configure listener ports on the server.
The connection string will look something like this
Create hole in the firewall on a different port than standard SQL server and use NAT to move this each side of the firewall. Also filter the IP address range if possible (providing others have fixed IP addresses.)
I have a small problem with M.Access. I have a form which achieves data from the 'select' query. Beside, this form has the Default View of Continuous Forms and the the scroll-bar property of Vertical only. However, when I run the form, the form always shows the vertical scroll-bar despite of the number of records.
I ever saw another form having the same property with the above form. In contrast, this form only shows the vertical scroll-bar when necessary.
please show me the way to solve this problem. I'm in dark. Thanks a lot.
I am not an ADO expert -- but I have ADO code to fix...
I've got this process which talks to the SQL server a lot. But over time, we start to get errors on the connection. We basically open a single ADO connection and reuse it for all of our stored procedure needs.
My question is this -- is this an appropriate and efficient way to use it. To just open one connection and use it forever.
OR -- is it appropriate to open a connection each time we do a stored procedure?
Also, if the single connection approach is appropriate, how does one fix a messed up connection?
I am just looking for some practical guidelines toward using ADO.
(1) Should I use a single shared connection?
(2) Should I Open() a connection for each stored procedure transaction?
(3) What's the best way to correct a screwed connection?
Normally, the recommended pattern is to create a connection for each operation or small group of related operations. With connection pooling enabled (the default), ADO will keep the physical connection open so it can be reused as required, creating additional connections only as they're needed. Connections that have been idle for a long time will eventually be disconnected.
Most connection objects are not thread-safe, IIRC. If there's a chance you're using your single connection object from multiple threads concurrently, this could well be causing your errors. Switching to a connection-per-operation model should sort this problem out.
In fact the ADO Connection object is marked as Apartment threaded. If you're using the correct operations to pass interface pointers between threads in a multithreaded program, calling a Connection object method will cause COM to marshal the call back to the thread that created the object. If you're not doing it properly, passing raw pointers around, then you could well be corrupting the internal state of the object.
i'm going to have an 'after update' trigger. but in that trigger i want to know which row has been updated causing this triger. in that triger i want to update another row in other table by id of that updated row.
please help me.
I can't figure out what I'm doing wrong.
I want to list all employees i have by the foreman they are associated with and count the number of installs they have done for the day. I have that part working. However if they have no installs at all for the day then they don't show up at all in the query and i'm wanting a complete employee list.
can someone please help? Here is my current query.
SELECT Employees_Tony.[Employee Name], MtrInstall.InstallDate, Count(MtrInstall.NewSN) AS CountOfNewSN, MaterialType.UtilityID, Formans_Tony.[Forman Name], Formans_Tony.FormanID, Formans_Tony.FormanID<br />
FROM (MaterialType INNER JOIN MtrAccount ON MaterialType.MaterialTypeID = MtrAccount.MaterialTypeID) INNER JOIN ((Employees_Tony INNER JOIN Formans_Tony ON Employees_Tony.FormanID = Formans_Tony.FormanID) INNER JOIN MtrInstall ON Employees_Tony.[Employee ID] = MtrInstall.EmployeeID) ON MtrAccount.AccountID = MtrInstall.AccountID<br />
GROUP BY Employees_Tony.[Employee Name], MtrInstall.InstallDate, MaterialType.UtilityID, Formans_Tony.[Forman Name], Formans_Tony.FormanID, Formans_Tony.FormanID<br />
HAVING (((MtrInstall.InstallDate)=#8/16/2005#));<br />
"If I wrote a book like I code. It would be one page thick and contain only one word (DUH!)"
SELECT Employees_Tony.[Employee Name], MtrInstall.InstallDate, Count(MtrInstall.NewSN) AS CountOfNewSN, MaterialType.UtilityID, Formans_Tony.[Forman Name], Formans_Tony.FormanID, Formans_Tony.FormanID
FROM (MaterialType LEFT OUTER JOIN MtrAccount ON MaterialType.MaterialTypeID = MtrAccount.MaterialTypeID) LEFT OUTER JOIN((Employees_Tony LEFT OUTER JOIN Formans_Tony ON Employees_Tony.FormanID = Formans_Tony.FormanID) LEFT OUTER JOIN MtrInstall ON Employees_Tony.[Employee ID] = MtrInstall.EmployeeID) ON MtrAccount.AccountID = MtrInstall.AccountID
GROUP BY Employees_Tony.[Employee Name], MtrInstall.InstallDate, MaterialType.UtilityID, Formans_Tony.[Forman Name], Formans_Tony.FormanID, Formans_Tony.FormanID
hi, is it possible to use a XML Dokument as a Database? because i dont want to install a SQL Server!
how can i establish a Odbc or Oledb Connection to the XML Database? than i want to fill the DataSet and display it in a DataGrid!
thx in advance! bye
surfman19 wrote: is it possible to use a XML Dokument as a Database?
Yes, if it is small and single user you could. However, if it got too large you would incur a large performance penalty. Also, if you need multiple users then you are going to run into all sorts of concurrency problems.
XML is not designed to be used as a database, it is good as a data transfer format though.
Can anyone suggest a quick reference on SQL commands and syntax that will work with ODBC or OleDb flat-files? Or that will work separately with non-SqlServer datasets in general?
For instance, I'd like to be able to use a t-sql style 'case-when-then' statement but am having no luck using it to pull records from a fixed-width text file I'm connecting to via an ODBC connection (a simple select with a where and order-by clause works fine).
My goal here is to be able to quickly find the syntax for all legal SQL statements within a given context, like any of us would expect with a regular t-sql manual, and know it will apply in a given environment.
I am not finding much help in the vs.net help files or web searches. Maybe I'm not looking in the right place or using the right search expressions? Everything seems to either be rudimentary select statements or assume you are using Sql Server databases.
In case it's helpful: I'm currently working on a console application in vb.net that needs to batch-process data in flat-files we get nightly, massaging the data with conditionals and some string manipulation, and updating other files. It should be possible to handle most of the process with a handful of SQL statements but I'm now looking at writing a bunch of nested vb routines instead. Not happy.
I have a DataTable with composite key bounded to the DataGrid.
So when the user inserts some data which violates the constraint, an exception is thrown.
What is the right place (event etc) to do any additional custom Validation?
Another problem is the the message that DataTable throws is not user friendly? How can I stop it and give a more meaningful message?
The message I got is
"Error when committing the row to the original data store"
i want to know how to select as item from the dropdownlist in the datagrid
and have the textbox in the datagrid filled with the corresponding value from database.
for eg if i select product name from dropdownlist then the textbox in datagrid must be populated with the price from the database for the corresponding product name.
override the DataGridTextBoxColumn's Edit function as following and file a custom event
protected override void Edit(System.Windows.Forms.CurrencyManager source, int row, System.Drawing.Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
CustomEventArgs e = null;
this.row = row;
//Fire Event and Take Decision
if (this.CustomCellEvent != null)
e = new CustomEventArgs (row, this.column, isEnabled, bounds);
//Fire the Event in Client Code
//Take decision based on value of e.IsEnable and e.IsReadOnly set by Client Code
this.isEnabled = e.IsEnable;
this.isReadOnly = e.IsReadOnly;
if (((CurrencyManager) source).Position == row)
base.Edit(source, row, bounds, readOnly, instantText, cellIsVisible);
this.source = source;
Subscribe to this event in the User control where the DataGrid is created.
Now in the event handler do the following to display the combobox.
i'm just learning asp.net, n it's really frustrating as i can't seem to be able to connect to it..
this is a simple code i wrote to insert records into a table called 'Cars" AND A DATABASE Called "MotorSolutions..
here is my code:
<%@ Page Language="vb" debug="true" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data" %>
Sub Page_Load(Source As Object, E as EventArgs)
If Page.IsPostBack Then
lblTitle.Text = "Submit was successful"
lblTitle.Text = "Leave the field blank and Submit"
Sub btn_click(Src As Object, E As EventArgs)
Dim DBConn as New SqlConnection
Dim DBAdd as New SqlCommand
DBConn = New SqlConnection("server=localhost;database=MotorSolutions;Uid=sa;pwd=5864jc;")
[SqlException: SQL Server does not exist or access denied.]
ASP.register2_aspx.btn_click(Object Src, EventArgs E) in c:\inetpub\wwwroot\motorsolutions\register2.aspx:30
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
Version Information: Microsoft .NET Framework Version:1.0.3705.0; ASP.NET Version:1.0.3705.0
is there something wrong with my connection string...i'd really appreciate it if anyone out there could test my code...my MotorSolutions database consists of only 2 fields:Manufacturer and Model...anyway, if u can't too it's ok..any meaningful feedback will do..Thanking you in advance.
The error message tells you "SQL Server does not exist or access denied".
This means that there are the following possibilities:
1. The SQL Server is not installed on the machine you refer to. In this case localhost. I've never seen a SQL Server connect to local host so you might want to change that to "(local)" or the name of your machine.
2. The SQL Server is not running. You can use the Microsoft SQL Server Service Manage to ensure that it is running properly.
3. Your log in credentials are wrong. You are using "sa" (a big security risk, if you don't mind me saying) in your web application. If the SQL Server was installed using "Windows Authentication" then the sa account is not accessible (because SQL Server logins are only available in mixed mode authentication). In this case you should use an appropriate trusted connection.
4. The password you supplied is incorrect (and, by the way, thanks for sharing your system administraton password with the world. You do know that with that level of access an attacker can gain control over your machine via SQL Server?).
I successfully use 'localhost' as the server in my connection string to SQL Server when I'm using Entrprize Library, but my friend has to change it when he puts my code on his machine. So, sometimes it works, and sometimes it doesn't. I havn't had time to look at why.
Last Visit: 31-Dec-99 19:00 Last Update: 8-Dec-23 14:50