|
|
Yes,
MS walk through using ReadXML.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbwlkWalkthroughAccessingXMLData.asp
|
|
|
|
|
I know sql pretty well but am new to ado.net.
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.
Thanks in advance for any help.
|
|
|
|
|
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"
|
|
|
|
|
hi all,
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
this.EnableDisableCellEvent(this, e);
//Take decision based on value of e.IsEnable and e.IsReadOnly set by Client Code
this.isEnabled = e.IsEnable;
this.isReadOnly = e.IsReadOnly;
}
if (this.isEnabled)
{
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.
comboBox.Left = this.dataGridAllocation.GetCellBounds(this.currentGridRow, this.currentGridColumn).Left;
comboBox.Top = this.dataGridAllocation.GetCellBounds(this.currentGridRow, this.currentGridColumn).Top;
comboBox.Width = this.dataGridAllocation.GetCellBounds(this.currentGridRow, this.currentGridColumn).Width;
comboBox.Height = this.dataGridAllocation.GetCellBounds(this.currentGridRow, this.currentGridColumn).Height;
comboBox.Visible = true;
comboBox.Focus();
On the SelectedIndexChanged event handler of the combobox
this.dataTable[this.dataGrid.CurrentCell.Row][this.dataGrid.CurrentCell.Column] = this.combobox.Text;
Hope this is useful.
|
|
|
|
|
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"
Else
lblTitle.Text = "Leave the field blank and Submit"
End If
End Sub
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;")
DBAdd.CommandText = "INSERT Into Cars(" _
& "Manufacturer, " _
& "Model) values (" _
& "'" & Replace(txtMF.Text, "'", "''") _
& "', " _
& "'" & Replace(txtModel.Text, "'", "''") _
& "')"
DBAdd.Connection = DBConn
DBAdd.Connection.Open
DBAdd.ExecuteNonQuery()
End Sub
<asp:label id="lblTitle" runat="SERVER">
Manufacturer: | | <asp:textbox id="txtMF" runat="server"> * <asp:requiredfieldvalidator
id="rfvManufacturer"
="" errormessage="Please enter the car manufacturer" runat="server" controltovalidate="txtMF" backcolor="#FFFF80" display="Dynamic"> | | Model : | | <asp:textbox id="txtModel" runat="server">
*
<asp:requiredfieldvalidator
id="rfvModel"
="" errormessage="Please enter the car model" runat="server" controltovalidate="txtModel" backcolor="#FFFF80" display="Dynamic"> | |
<asp:button id="btnSubmit" runat="SERVER" text="Submit" onclick="btn_click">
please can somebody help me...i keep getting this error:
Server Error in '/' Application.
SQL Server does not exist or access denied.
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: SQL Server does not exist or access denied.
Source Error:
Line 28: & "')"
Line 29: DBAdd.Connection = DBConn
Line 30: DBAdd.Connection.Open
Line 31: DBAdd.ExecuteNonQuery()
Line 32:
Source File: c:\inetpub\wwwroot\motorsolutions\register2.aspx Line: 30
Stack Trace:
[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.SqlConnection.Open() +761
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
System.Web.UI.Page.ProcessRequestMain() +1263
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?).
Does this help?
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
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.
|
|
|
|
|
If he puts your code on his machine, localhost won't work to connect to SQL Server on *your* machine, if that's what you mean.
On the other hand, localhost should work at his machine to connect to SQL Server on *his* own machine. I've used localhost with SQL Server before, altough I usually use (local) .
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
I mean he can't connect using 'localhost' to connect to the database running on his own machine. It works fine for me to connect to a database on my machine, but he just changes the config string when I send him a new set of source code. It's not really a problem, but just anoying that it doesn't work. We are both using xp pro. The only differences I know of are that his is a laptop joined to a domain, and mine is a desktop in workgroup mode.
|
|
|
|
|
Thank you to everyone who helped me Luis, Scott, and especially too Colin..you made my day! it worked.. i changed it to (local) n it worked fine..
Thank you once again ...to everyone..i would have spent weeks..n not find the solution coz i was so convinced that my connection string was correct...and yes...about the password..point noted..
|
|
|
|
|
localhost is a TCPIP or DNS name for your local computer. It will only work in the connection string for SQL server if the TCPIP client transport is installed and enabled, and there is an active network connection (or loopback connection). "(local)" is an SQL Server name recognised as the local instance of the SQL server, and connection is made using shared memory (SQL2k) or named pipes (SQL7). The reason localhost sometimes works and sometimes doesn't is likely related to the way the networking on the computer is (or isn't) set up.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
How do I use a check box on an unbound database in vb.net?
BINARY
|
|
|
|
|
What do you want to do exactly ? Is it ASP.NET or a windows app ? What's the problem with the check box ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I got it figured out thanx
BINARY
|
|
|
|
|
Binary0110 wrote:
How do I use a check box
by clicking on it dude !!!
(hey, don't matter, it's just a joke)
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|
I have a situation where i have a database with 19 tables in it.
I am required to develop an abstraction layer for this database, and have been juggling reams of SQL and .Net objects with an aim to get it working.
Fundamentaly I require each database table to be represented by a .Net object, and the functionality to build an object from the database, update / insert an object to the database.
Now, currently, i am writing the SQL and Code for this. However, it is taking bloody ages as some of the tables are pretty large, and getting all the fields and names set up in different fields is a monumental chore. (Not to mention dull)
The question i have is, are there any tools out there for converting a database (Sql Server in this case) into a collection of classes that represent the tables in the database and can be easily manipulated.
I have looked on the internet, but come up with only techniques to approach the problem.
Additional functionality as far as the objects concern is to be built later, but the core objects are still going to be required in their raw form.
Any help appreciated.
Regards
Tris
|
|
|
|
|
Here you go. You have all the readymade stuff here
http://sourceforge.net/projects/sqlom
Great tool.
|
|
|
|
|
|
I´ve got a report to show in VB.NET which i created using the embedded crystal reports designer that comes with visual studio. In that report i´ve got two tables in a dataset linked by a common field. The report has about 1000 rows and it takes too much time too load. And in top of all, cpu usage goes up to 99%... I read in google that in the crystal reports software (the full version) there is an option called "save data with report", that if it´s disabled can speed up the report load, but i can´t find it anywhere in visual studio.
Sorry about my english, and thanks for reading, i really need an answer!
|
|
|
|
|
I use .NET Framework 1.1, MS SQL server 2000, C# language
In my application, the function 'Backup data' executes 'BACKUP DATABASE...' to backup it's MS SQL Server database (in Database Server).
If my path/folder to backup file does not exit, it throw an exception: "Cannot open backup device..."
How can I the path or folder does not exist, so I can notify to end user.
Thanks.
None
|
|
|
|
|
Dear all
I use the "describe TABLENAME" command in SQL Plus with oracle to get the attributes of a table.
Can I use this command with MS Access and C#?
thanks
|
|
|
|
|
No. That is not a standard sql keyword, and is specific to Oracle IIRC.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|