KeyInfo using Data Access Application Block for .NET
Is there a way to retrieve the KeyInfo using the Microsoft Data Access
Application Block for .NET?
I want to use either a DataSet or SqlDataReader object to grap the primary
key information from the columns. Tag: VB.NET PROJECT to C# Project conversion Tag: 90104
405 error on put
I am trying to upload a pdf file to a web server. The server is local
right now for testing.
I am running xp, iis5
I get a 405 error on the post, please help.
String uriString = "http://localhost/PineNet/";
WebClient myWebClient = new WebClient();
string fileName = txtFilename.Text;
byte[] responseArray =
myWebClient.UploadFile(uriString,"POST",fileName);
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com Tag: VB.NET PROJECT to C# Project conversion Tag: 90101
Viewstate works on test server but not production server
Please help! I am tearing out my eyes trying to figure this out. I have a test server IIS 5.0 and a production server IIS 6.0. The test server holds the viewstate of a 3 dropdowns with a problem. However, the production server only holds the viewstate of 2 of the dropdowns. Why would it work on one server and not the other? Why would it work for 2 of the controls but not all 3? THANK YOU IN ADVNACE FOR THE HELP.
I am using ASP.NET with VB (no code behind). Here is a snippet of the code. DropList_OS is the problematic dropdown.
<asp:DropDownList id="dropList_Dates" runat="server" dataTextFormatString="{0:d}" CssClass="Headings" AutoPostBack="True">
<asp:ListItem Value="{0}" Selected="True"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList id="dropList_Regions" runat="server" CssClass="Headings" AutoPostBack="True">
<asp:ListItem Value="{0}" Selected="True"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList id="dropList_OS" runat="server" CssClass="Headings" AutoPostBack="True"></asp:DropDownList> Tag: VB.NET PROJECT to C# Project conversion Tag: 90094
Annotations in Strongly typed datasets with webservices
hi,
I am using annotiations in my xsd schema. the dataset is generated correctly on my webservice, but when i add a webreference to the webservice from another webservice, the dowloaded xsd schema from my webservice doesn't contain the annotiated names, my codegen namespace is filtered out of the xsd schema.
Has anyone an idea to resolve this Tag: VB.NET PROJECT to C# Project conversion Tag: 90091
Add sorting to SQLDataAdapter at runtime. How?
I have a SQLDataAdapter that I have configured. Since I want to tie this to
a DataGrid and add sorting to the datagrid, I do not want to configure the
adapter with sorting. I want to be able to add the sorting at runtime
depending on the column that the user clicked on the datagrid. I am probably
missing something very simple here. Below is the code that I am using to
fill my datagrid.
Thanks in advance!
sqlMfgNumber.SelectCommand.Parameters(0).Value = "%" &
txtSearchFor.Text.Trim & "%"
sqlMfgNumber.SelectCommand.Parameters(1).Value = strOmittedNumber
sqlMfgNumber.Fill(DsMfgNumberSearch1)
If DsMfgNumberSearch1.Tables(0).Rows.Count > 0 Then
lblError.Visible = False
Datagrid1.DataSource = DsMfgNumberSearch1
Datagrid1.DataBind()
Else
lblError.Visible = True
End If Tag: VB.NET PROJECT to C# Project conversion Tag: 90090
Persistance UPDATE problem - revised Q for clarity
I'd like to clear up a very long-standing problem I have had only because I have done a little more testing, but the problem is still there.
On Page_Load event, the textfields on my page fills with the personal data stored in a SQL DB, as follows:
Dim cn As SqlConnection
Dim cmd As SqlCommand
Dim rdr As SqlDataReader
cn = New SqlConnection("xxx")
cn.Open()
cmd = New SqlCommand("SELECT SName FROM ClientDetails WHERE clientRef=100", cn)
rdr = cmd.ExecuteReader()
rdr.Read()
'fill the surname textbox
txtSName.Text = rdr("ColSurName")
cn.Close()
e.g. pretend the value of the colSurNamel in the DB is 'Smith'
Then on the form my clients can update their details by simply overwriting the text in the textboxes and hitting the UPDATE button.
Assume I have now updated the textbox with 'Bloggs' and I've hit the UPDATE button (code as follows):
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim conCOMP As SqlConnection
Dim cmdUPDATECOMP As SqlCommand
conCOMP = New SqlConnection("xxxxxx")
strCOMP = "UPDATE ClientDetails SET colSurName= '" & txtSName.Text & "' WHERE ClientRef = 100"
cmdUPDATECOMP = New SqlCommand(strCOMP, conCOMP)
Label4.Text = strCOMP
conCOMP.Open()
cmdUPDATECOMP.ExecuteNonQuery()
conCOMP.Close()
End Sub
I've added a label here to view the value of the UPDATE command when it is passed BUT it gives the value already stored in the DB / or rather the value it already got in the Page_Load routine:
the text in Label4 is: " UPDATE ClientDetails SET colSurName = 'Smith' WHERE ClientRef = 100 "
I think it is obviously the text box variable: having got a value for when the Page_Load event occurs. But how can my clients change the text boxes to update their details and hit UPDATE??????
PLEASE PLEASE HELP. This seriously has been BUGGing me for a month. My Client is not happy :( Tag: VB.NET PROJECT to C# Project conversion Tag: 90089
Stupid XML Serialisaton and Web Services
My company's XML webservice has several methods that pass back=
serialised data, and all seemed well during testing, and during=
the first few weeks of deployment=2E But people are coming back to=
me saying that the keep getting the error "DataRelation cannot=
be serialized because it does not have a default public=
constructor" when they browse to the URL of the Web Service=2E But=
it does have a public constructor, it really does, and now it's=
driving me up the wall=2E
Thanks
--------------------------------
Matthew Carter
Development Manager
Applied Language
http://www=2Eappliedlanguage=2Ecom
-----------------------
Posted by a user from =2ENET 247 (http://www=2Edotnet247=2Ecom/)
<Id>eDIiibqwKEyiHx8pwjI4lA=3D=3D</Id> Tag: VB.NET PROJECT to C# Project conversion Tag: 90084
Stupid XML Serialisaton and Web Services
My company's XML webservice has several methods that pass back=
serialised data, and all seemed well during testing, and during=
the first few weeks of deployment=2E But people are coming back to=
me saying that the keep getting the error "DataRelation cannot=
be serialized because it does not have a default public=
constructor" when they browse to the URL of the Web Service=2E But=
it does have a public constructor, it really does, and now it's=
driving me up the wall=2E
Thanks
--------------------------------
Matthew Carter
Development Manager
Applied Language
http://www=2Eappliedlanguage=2Ecom
-----------------------
Posted by a user from =2ENET 247 (http://www=2Edotnet247=2Ecom/)
<Id>CYL2gyk18kiRmISG88IWbw=3D=3D</Id> Tag: VB.NET PROJECT to C# Project conversion Tag: 90083
Autoincrementing Primary Keys with PostGres
I am using an ODBC connection to a PostGres database, that has various tables that use SERIAL types to implement automatically incrementing primary keys.
My problem is that I have a dataset containing tables that I have turned AutoIncrement on, and set the seed and step to -1. My update statement works a treat, and any new rows are added sequentially to the end of the table. However, I need a way of immediately returning a new rows primary key, in order to keep the dataset up to date.
I know that in SQL Server you can use the @@IDENTITY feature, to immediately return the last used value. Is there something similar in PostGres?
I have tried adding a 'SELECT CURRVAR('public.equipmenttype_equipmenttypeid_seq') just after my insert statement (which is the SQL that you use to find out the current sequence id in PostGres), but I am not sure of the ODBC syntax needed to get this information into a parameter (I assume I would need to use a ParameterDirection.ReturnValue).
This problem has been vexing me for a few days now. Any ideas or a better way of handling autoincrementing keys would be gladly received. Tag: VB.NET PROJECT to C# Project conversion Tag: 90076
DataTable column question
Hi!
It's easy to add Columns into DataSet DataTable for example like this way
...
ds.Tables("MyTable").Columns.Add("MyColumn", GetType(Integer))
... but how can I remove this column of the DataSet which was created
earlier by code? Do I have to create whole new DataSet table again?
I mean something like ds.Tables("MyTable").Columns.Remove("MyColumn") -
ofcource it's not possible to do like this way :)
I tried ... ds.Tables("MyTable").Columns("MyColumn").Dispose() ... but it
doesn't seem to do what I want.
--
Thanks in advance!
Mika Tag: VB.NET PROJECT to C# Project conversion Tag: 90065
Persistent UPDATE Problem
Hi there
I have had an application where I have not been able to successully add an 'update details page' for my clients logged in to the website.
I have posted a query on this before and the result was that the WHERE clause was probably wrong; without success....but I have added a test labels to test so now know a little more so hopefully you can help.
Have ASP.NET / SQL Server 2000. The web app has a members area which is https. i'm using authenication ticket which stores the member ID ref as a state variable called 'MemberRef'
So problem page....
When this UPDATE PERSONAL DETAILS page loads, it fills the textboxes on the page with a datareader according to who is logged in. One textbox example is as follows:
txtFirstName.Text = rdr("colFName")
Then of course I need a process so my members can update their personal details stored in the DB, so those text boxes allow updates and I've added a button which should update the DB
Private Sub ButUpdatePractice_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 'Handles ButUpdatePractice.Click
Dim strCOMP As String
Dim conCOMP As SqlConnection
Dim cmdUPDATECOMP As SqlCommand
conCOMP = xxx
cmdUPDATECOMP = New SqlCommand(strCOMP, conCOMP)
strCOMP = "UPDATE ClientDetails SET colFName = @Fname WHERE MemberRef = @MemberRef"
cmdUPDATE.Parameters.Add("@Fname", txtFirstName.Text)
cmdUPDATE.Parameters.Add("@@MemberRef", MemberRef)
conCOMP.Open()
cmdUPDATECOMP.ExecuteNonQuery()
conCOMP.close
-now plrease ignore any misspellings above - done it for speed for this forum.
Now this doesn't update the DB when pressing the update button. It re-freshes the page. I've added a label to the page which shows the strCOMP update string on the page to test ( label1.text = strCOMP ) and it contains the existing value from the DB.
Please help. Tag: VB.NET PROJECT to C# Project conversion Tag: 90062
Dataset constraint violoation with null foreign key value
Hi,
I'm loading a dataset from a cached viewstate version of the dataset created
on a previous http request. When I read the call ReadXml on the typed
dataset, I get:
"Failed to enable constraints. One or more rows contain values violating
non-null, unique, or foreign-key constraints"
I suspect this is due to a field in one of the tables which can be null, but
if it is not null it is a foreign key to another dataset table. At present
the field in this table is null (in the database).
What attributes of the dataset table field, or the dataset constraint should
I set to indicate null values don't violate the constraint?
Thanks
Martin Tag: VB.NET PROJECT to C# Project conversion Tag: 90061
Datagrid hide identical columns from a JOIN
I do not normally use JOINS in my queries these days, but I have some
instances where I am simply showing historical data in a grid, and it is
thus much more convenient to JOIN everything I need in one stored procedure.
Thus I might end up with data from 3, 4 or more tables -- some with
identical names (the JOIN criteria).
I know how to hide columns in a straightforward query, but how about in a
JOIN query where you may have 2 or even 3 or more identical field names (IDs
usually)? How do you hide, for example, the SalesID from the 2nd table or
the from the 3rd table? For example, the following statement works for the
first SalesID, but what about the other JOINED SalesID fields? (I've tried
"SalesID1" and "Expr1", but no joy except SalesID1 seems to work on a simple
query with 2 joined tables).
ds.Tables("dtSalesPayments").Columns("SalesID").ColumnMapping =
MappingType.Hidden Tag: VB.NET PROJECT to C# Project conversion Tag: 90057
.NET SQL Client: Connection pooling issue
Hi All
Follow up to my last week' postings on connection pooling issue we
experience. Thanks all for your replies but since I still don't have a
solution ? I've decided to start a new thread. Here is a link to the
original thread: http://tinyurl.com/yu68q
We use SQL Client (SqlCommand, SqlConnection and SqlDataReader) in our
3-tiered ASP.NET app written in C#. The problem we are running into is
that under heavy load the number of pooled connections increases
approximately by the current pool size every time the garbage
collector kicks in.
This happens even when only about 60 connections exists in the pool
with the max size of 100. The number of pooled connections does not
grow until the GC engages and ? the most puzzling ? the new connection
pool is being created at that very moment.
I rely on .NET CLR Data performance counters which I suspect might not
be reliable. But if they aren't ? what is? The documented MS Knowledge
base issue with the counters
http://support.microsoft.com/default.aspx?scid=kb;en-us;314429 doesn't
seem to apply here)
I also follow all the good coding practices such as closing the
connection and DataReader in the finally block. I do not have any
destructors or Finalize implementations in the app as well. I have
performance monitor screenshots for all interested.
Any ideas?
Thank you! Tag: VB.NET PROJECT to C# Project conversion Tag: 90054
HLP: Adding Column Info to ListView
What I'm trying to do is to Add the information of Two Tables into a single
ListView. The ListView has 10 columns.
The following Code populates the LV columns 1 to 5 (or rather 0 to 4) from a
DataSet...
Private Sub MstrEmPay()
Dim dtDataTbl As DataTable = DsMstrEmPay.MASTER_PRM_EMPLOYEE_PAY
' Get Info from Data Base
For cntr = 0 To DsMstrEmPay.MASTER_PRM_EMPLOYEE_PAY.Rows.Count - 1
Dim dr As DataRow = dtDataTbl.Rows(cntr)
Dim LItem As New ListViewItem
Dim rowTtl As Double = 0
LItem = New ListViewItem
LItem.Text = dr("amount")
LItem.SubItems.Add(dr("employee"))
LItem.SubItems.Add(dr("pay_id"))
LItem.SubItems.Add(dr("pay_type"))
lvProjDisplay.Items.Add(LItem)
Next ' cntr
End Sub
What I want to do is to get the info of another DataSet and dump it's info
into the next 5 remaining Columns (starting at the first row of the
ListView).
I've done some reading and I 'think' I need something like:
LItem.SubItems.Insert(5, myTextHere)... but haven't found how to make this
work.
Anyone can help?
Regards,
Bruce Tag: VB.NET PROJECT to C# Project conversion Tag: 90053
SQL Server JOBS
Hi!.
I am developing a windows application where i need to give users alerts about their pending jobs once they login into the application. I am trying to create SQL Server jobs to give those alerts( If anyone has any other option kindly post the same). now can anyone tell me how do i populate the alert on the user machine.
Thanks in advance
Baren Tag: VB.NET PROJECT to C# Project conversion Tag: 90048
Het zal toch niet zijn wie ik denk dat het is?
Is het die Ear Youth weer? Nee, het is Arjen Jongeling!
Het is een kwestie van geduld
voor heel usenet Hollands lult Tag: VB.NET PROJECT to C# Project conversion Tag: 90044
Making an app run on a local area network.
I realize I have asked this question before and the answer is slowly
becoming clearer but I do not yet quite have it in place. I have a VB.net
application that I have written from a client machine of a local area
network. The LAN has a dedicated file server. The solution is located in a
shared directory of the LAN's file server The drive letter is F. The
application is bound to a SQL Server 2000 database that also resides in a
shared directory on the F drive of the file server.
My application works on the machine I am using but then I have a full blow
copy of VS 2003 installed on the machine. I would like to be able to run
the application from other machines on the local area network. These other
machines all have Windows XP Pro installed and the .net framework.
What do I need to do in order for this to happen? If I understand correctly
I do not have to even worry about creating a .MSI file; I can simply point
the other machines to the .exe file that is created in the Bin directory of
the application that, again, is located in a shared directory of the server.
Is this right? What else do I need to do in order to make (allow) this
application to run from other machines on the Local Area Network? Tag: VB.NET PROJECT to C# Project conversion Tag: 90042
Cannot change row in RowUpdating event
Hi,
I had expected to be able to change the DataRow that is passed into the RowUpdating event, but for some reason it does not seem to work. Am I doing something wrong or is a workaround?
--
Thanks in advance,
Juan Dent, M.Sc. Tag: VB.NET PROJECT to C# Project conversion Tag: 90041
detaching an XmlDataDoc from a DataSet
Hi All,
I've got an XmlDataDocument that is attached to a DataSet with one DataTable
in it. Then I take the XML as text and throw it into a Text Box on a form.
Later on, I wanted to add another DataTable to the DataSet and it
complained:
Cannot add or remove tables from the DataSet once the DataSet is mapped to a
loaded XML document.
How do/can I detach the XMLDataDoc from the DataSet?
Thanks!
Corey. Tag: VB.NET PROJECT to C# Project conversion Tag: 90040
ADO Shape command to return XML
I'd like to be able to utilize the ADO Shape syntax to return XML.
I've seen examples in MSDN that returns an OLEDB DataReader of this hierarchical data..however I'd like the XML out of it.
I've done this in the previous version of ADO, but I haven't figured out how to do this in ADO.NET. Any insight would be appreciated.
Many thanks-
Dan Tag: VB.NET PROJECT to C# Project conversion Tag: 90033
How to create data adapter for multiple tables (joint tables)?
I use sql builder to create a dataadapter. If there is only one table, the
insert/update/delete commands are automatically created successful. However,
if I build a select command based on multiple tables, I got errors:
"insert/update/delete commands can't create automatically for multiple
tables...?". Any of you know how to accomplish this?
Any suggestions are greatly appreciated.
-V Tag: VB.NET PROJECT to C# Project conversion Tag: 90023
Query Analyzer speed vs. SqlCommand.ExecuteReader speed
All,
I have an SP that takes about 5 seconds to run before any caching performed by SQL server (I run DBCC DROPCLEANBUFFERS to make sure in my tests).
When I hook the SP into a SqlCommand object, the SP Cmd.ExecuteReader line takes about 5 seconds every time I reload the page. But if I run it through Query Analyzer it takes 5 seconds for the first run and every subsequent request is less than half a second. I assume this is behavior of Sql Server caching the tables/results.
My question is why would Cmd.ExecuteReader take 5 seconds each time if Sql Server is indeed caching teh tables/results (as evidenced by the fast subsequent QA calls)? It is possible there is SET environment variable being called by SqlCommand, or a lack of variable in the connection string that causes the ExecuteReader to take so long each time?
Thanks,
JL Tag: VB.NET PROJECT to C# Project conversion Tag: 90022
global connection or seperate connections for each stored proc cal
Hi I seem to recall reading that it can be a bit risky using just 1 global data connection in the global.aspx file, instead of multiple connections, but can not recall why. Also is there a lot of overhead with multiple connections? I did a search but did not find anything. Thanks.
--
Paul G
Software engineer. Tag: VB.NET PROJECT to C# Project conversion Tag: 90017
sqladapter question
I create the sqladapter programmically.
Dim daInvoice As new sqladapter ("select * from invoice",conMaster)
daInvoice.fill(dsInvoice)
bmInvoice = Me.Bindingcontext(....etc)
Me.txtInvoiceNo.DataBindings.Add("text", dsInvoice,"invoice.invno")
Now, in my add click event. (bmInvoice.addnew())
in my save event.
daInvoice.update(dsInvoice,"Invoice") <-- I got an error here, it said I
need to declare the updatecommand first.
dsInvoice.update()
my invoice got over 50 fields name , DO I need to create 50 parameters in
the commandtext ???
anyshort to update this tables ??
Thanks
From Agnes Tag: VB.NET PROJECT to C# Project conversion Tag: 90012
Informix .net provider - Sql server .net provider
Hello everybody
We are currently writting a small app that will be delivered on an Informix
DB and a Sql Server DB. We will be doing some performance check pretty soon
for both databases.
Is anybody using something else other than the IBM informix provider, and
the regular SqlServer provider coming with the .net framework ?
And if so, anybody happy with the ones they chose ?
Regards Tag: VB.NET PROJECT to C# Project conversion Tag: 90011
How to know total records selected?
Hello Group,
How can i obtain the total no of records selected with the help of
Datareader class. rowsaffected does not seem to work.
Thanks
Anand Tag: VB.NET PROJECT to C# Project conversion Tag: 90009
System.InvalidCastException
Hi !
First of all, I apologize for my poor english...
I've a cast problem with the code you can find below.
I really don't understand why ?
I'm trying to make a very simple WindowsForm application wich works with the
customers table of the northwind database.
You can find the database hear :
http://www.microsoft.com/downloads/details.aspx?FamilyID=C6661372-8DBE-422B-8676-C632D66C529C&displaylang=EN
There is no problem if you remove this line of code :
Me._dg.TableStyles.AddRange(New System.Windows.Forms.DataGridTableStyle()
{Me._ts})
I just want to populate my DataGrid with the CustomerID (and later the
CompanyName) and using styles seems to be a good way to do this ?
Can every one help me to find what's the problem with my code...?
Any help would be appreciated.
Hervé
**** code ****
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Namespace DefaultNamespace
Public Class MainForm
Inherits System.Windows.Forms.Form
Private _cnx As System.Data.OleDb.OleDbConnection
Private _tbcID As System.Windows.Forms.DataGridTextBoxColumn
Private _ds As System.Data.DataSet
Private _cmdSelect As System.Data.OleDb.OleDbCommand
Private _ts As System.Windows.Forms.DataGridTableStyle
Private _dg As System.Windows.Forms.DataGrid
Private _da As System.Data.OleDb.OleDbDataAdapter
Public Shared Sub Main
Dim fMainForm As New MainForm
fMainForm.ShowDialog()
End Sub
Public Sub New()
MyBase.New
'
' The Me.InitializeComponent call is required for Windows Forms designer
support.
'
Me.InitializeComponent
'
' TODO : Add constructor code after InitializeComponents
'
Me._da.Fill(Me._ds, "Customers" )
End Sub
#Region " Windows Forms Designer generated code "
' This method is required for Windows Forms designer support.
' Do not change the method contents inside the source code editor. The
Forms designer might
' not be able to load this method if it was changed manually.
Private Sub InitializeComponent()
Me._da = New System.Data.OleDb.OleDbDataAdapter
Me._dg = New System.Windows.Forms.DataGrid
Me._ts = New System.Windows.Forms.DataGridTableStyle
Me._cmdSelect = New System.Data.OleDb.OleDbCommand
Me._ds = New System.Data.DataSet
Me._tbcID = New System.Windows.Forms.DataGridTextBoxColumn
Me._cnx = New System.Data.OleDb.OleDbConnection
CType(Me._dg,System.ComponentModel.ISupportInitialize).BeginInit
CType(Me._ds,System.ComponentModel.ISupportInitialize).BeginInit
Me.SuspendLayout
'
'_da
'
Me._da.SelectCommand = Me._cmdSelect
'
'_dg
'
Me._dg.CaptionVisible = false
Me._dg.DataMember = ""
Me._dg.DataSource = Me._ds
Me._dg.Dock = System.Windows.Forms.DockStyle.Left
Me._dg.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me._dg.Location = New System.Drawing.Point(0, 0)
Me._dg.Name = "_dg"
Me._dg.ReadOnly = true
Me._dg.Size = New System.Drawing.Size(204, 418)
Me._dg.TabIndex = 0
Me._dg.TableStyles.AddRange(New System.Windows.Forms.DataGridTableStyle()
{Me._ts})
'
'_ts
'
Me._ts.DataGrid = Me._dg
Me._ts.GridColumnStyles.AddRange(New
System.Windows.Forms.DataGridColumnStyle() {Me._tbcID})
Me._ts.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me._ts.MappingName = "Customers"
Me._ts.ReadOnly = true
'
'_cmdSelect
'
Me._cmdSelect.CommandText = "select * from Customers"
Me._cmdSelect.Connection = Me._cnx
'
'_ds
'
Me._ds.DataSetName = "Customers"
Me._ds.Locale = New System.Globalization.CultureInfo("fr-FR")
'
'_tbcID
'
Me._tbcID.HeaderText = "ID"
Me._tbcID.MappingName = "CustomerID"
Me._tbcID.NullText = " "
Me._tbcID.ReadOnly = true
Me._tbcID.Width = 80
'
'_cnx
'
Me._cnx.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";Data
Source=E:\Projets\Customers\bas"& _
"e\Nwind.mdb;Persist Security Info=True"
'
'MainForm
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(564, 418)
Me.Controls.Add(Me._dg)
Me.Name = "MainForm"
Me.Text = "MainForm"
CType(Me._dg,System.ComponentModel.ISupportInitialize).EndInit
CType(Me._ds,System.ComponentModel.ISupportInitialize).EndInit
Me.ResumeLayout(false)
End Sub
#End Region
End Class
End Namespace Tag: VB.NET PROJECT to C# Project conversion Tag: 89998
Common DataSource gives unexpected behavior with comboboxes
When I have 2 comboboxes whos datasource is the same datatable I get some unexpected (and unwanted) behavior. When I change the selection in either combobox, the other changes to match it. The behavior probably applies to other controls as well.
I would guess binding is being overly helpful, but I need to know how to disable it.
I've considered just making of copy of my datatable for one of the controls, but I doubt that is the proper solution. Tag: VB.NET PROJECT to C# Project conversion Tag: 89991
Make data available to Excel, Access, ...
Hi,
sorry for the cross post, but don't know which of both groups would be the
best one.
I have implemented a .Net DataReader and DataAdapter for our custom data and
it works fine so far. Now I want to make the data available to Excel,
Access, ... One solution would be to develop a OLEDB Provider in C++ via ATL
Templates. But I wonder if there is a simpler way!? Can I develop a OLEDB
Provider in C#? Or is there a mapping between OLEDB and .Net Datasources?
regards,
Achim Tag: VB.NET PROJECT to C# Project conversion Tag: 89987
is there a performance benefit when using Prepare() on command that
Hi,
I was just reading the book "ADO.NET in a Nutshell".
In the chapter on the Command-Object (p. 36) it reads:
"A parameterized command won't improve performance as compared to the
original dynamic SQL statement. Unlike a stored procedure, a
parameterized query isn't stored in the database and isn't precompiled.
The difference is simply one of syntax."
OK. Sounds plausible to me. But i recalled reading something different
to that on MSDN. The article "Best Practices for Using ADO.NET"
(http://msdn.microsoft.com/library/en-us/dnadonet/html/adonetbest.asp?frame=true#adonetbest_topic4)
includes the following:
"The Command.Prepare method can improve the performance of parameterized
commands that are repeated at your data source. Prepare instructs the
data source to optimize the specified command for multiple calls. To use
Prepare effectively, you need to thoroughly understand how your data
source responds to the Prepare call. For some data sources such as SQL
Server 2000, commands are implicitly optimized and a call to Prepare is
unnecessary. For other data sources such as SQL Server 7.0, Prepare can
be effective."
So, who is right? Or am I just getting something wrong and mixed up?
Is the effect of the Prepare()-call specific to the data source?
Does it only work with SPs or also with plain SQL-Text?
Any help will be greatly appreciated.
Thanks in advance,
Lorenz Tag: VB.NET PROJECT to C# Project conversion Tag: 89985
Inserting Nulls into a Dataset
Hi
I have a simple table which allows nulls. Using a Dataset I have added a new
rows to the table specifying the values for the columns I have and leaving
the others.
When I come to run the update command via the dataadapter the insert stored
procedure fails because the parameters corresponding to the null fields in
the dataset and not supplied. How do I get round this?
Regards Tag: VB.NET PROJECT to C# Project conversion Tag: 89984
RE: SQLCE Problem on Create Table
*The code is below. It always stuck on line "command4.ExecuteNonQuery()" and
it throws an Sqlce exception
Under Public Class Form1 definition:
Private Const filename4 As String = "MUSTERI.SDF"
Private connstr4 As String = String.Format("Datasource={0};Password={1}",
filename4, "Admin")
Private connection4 As SqlCeConnection
Under Private sub CreateDB Click():
Dim engine4 As New SqlCeEngine(connstr4)
If Not File.Exists(filename4) Then
engine4.CreateDatabase()
Else
MsgBox("FILE EXISTS")
End If
engine4.Dispose()
connection4 = New SqlCeConnection(connstr4)
connection4.Open()
Dim command4 As SqlCeCommand = connection4.CreateCommand
command4.CommandText = "CREATE TABLE MUSTERI (INDEXMS nvarchar(5),MSAD
nvarchar(30),MSSOYAD nvarchar(30),MSSEMT nvarchar(30),MSSEMTRCH
nvarchar(30),MSTLF nvarchar(15),FIYAT nvarchar(3),INDEXBY
nvarchar(4),VHMARKA nvarchar(30),VHMODEL nvarchar(50),VHLSEBAT
nvarchar(20),VHYIL nvarchar(4),LASONMRK nvarchar(20),LASONDSN
nvarchar(30),LASRKMRK nvarchar(20),LASRKDSN nvarchar(30),VHDSSGON
nvarchar(10),VHDSSGRK nvarchar(10),VHDSSLON nvarchar(10),VHDISSLRK
nvarchar(10),VHPLAKA nvarchar(15),VHIDHVON nvarchar(3),VHIDHVRK
nvarchar(3),TARIH nvarchar(10),USER nvarchar(5))"
command4.ExecuteNonQuery()
command4.Dispose()
MsgBox("MUSTERI.SDF TAMAM")
' 4TH Creation Complete
connection4.Close()
"Enver A" <ea90@hotmail.com> wrote in message
news:%23r8xTZhUEHA.2484@TK2MSFTNGP11.phx.gbl...
> Hey ppl,
> I am having trouble in building a smart device application. I cant create
a
> table on SQLCE server using this line. Anyone can tell me what the problem
> is?
> I am able to create another 3 Tables same way but this SQL line is always
> gives me problems.
>
>
> command4.CommandText = "CREATE TABLE MUSTERI (INDEXMS nvarchar(5),MSAD
> nvarchar(30),MSSOYAD nvarchar(30),MSSEMT nvarchar(30),MSSEMTRCH
> nvarchar(30),MSTLF nvarchar(15),FIYAT nvarchar(3),INDEXBY
> nvarchar(4),VHMARKA nvarchar(30),VHMODEL nvarchar(50),VHLSEBAT
> nvarchar(20),VHYIL nvarchar(4),LASONMRK nvarchar(20),LASONDSN
> nvarchar(30),LASRKMRK nvarchar(20),LASRKDSN nvarchar(30),VHDSSGON
> nvarchar(10),VHDSSGRK nvarchar(10),VHDSSLON nvarchar(10),VHDISSLRK
> nvarchar(10),VHPLAKA nvarchar(15),VHIDHVON nvarchar(3),VHIDHVRK
> nvarchar(3),TARIH nvarchar(10),USER nvarchar(5))"
>
> Tag: VB.NET PROJECT to C# Project conversion Tag: 89980
Create DataSet from ArrayList
How can I create a dataset from an arraylist? I thought I could fill a
dataset using an arraylist as the datasource but I can't find the way to do
this?
Wayne Tag: VB.NET PROJECT to C# Project conversion Tag: 89976
Insert SQL statements into a DB record using Command object?
Hello,
I'm porting a VB6 / ADO application to VB/ADO.net and I'm running into
some ADO.Net problems.
I have a system that allows users to write and test their own SQL
statements, and then save them to the SQL Server in a table called
AdHoc.
(They are not allowed to use certain destructive statements such as
DROP, DELETE)
When they are happy with the results of the query, they save the SQL,
and a short menu text into the database. They can then select and run
the query they created by choosing it from a combo box (using the menu
text).
This was never a problem in ado classic, but when I use an ADO.net
command object and call the .ExecuteNoneQuery method, it seems that
the SQL statements I want to add or update in the database, are
getting mixed up in the SQL Insert or Update statements that actually
do the saving/updating of the database.
So I guess my question is: how can I execute an SQL statement that has
string fields, that contain SQL statements themselves.
Anyone?
ss. Tag: VB.NET PROJECT to C# Project conversion Tag: 89972
reflexive relation in dataset
Hi all,
I've got the following problem:
I need to describe a tree structure, the table in the dataset consists
of the columns structID, parentStructID, description with structID as
primary key.
the parentStructID of a root treenode is DBNull.
I define a reflexive 1:n relationship from treestructID to
parentTreeStructID.
loading the the database table into my dataset produces an error,
because the DBNull-value of my root tree node violates my DataSet
relation (but not the relation defined in my database, anyway).
common solution is: setting the nested-property of the DataRelation in
my DataSet to true. that works fine, so far so good.
here's the heart of the problem:
setting the nested property to true in VS2003 dataset desginer lets the
code generator forget my relation. that means if I instanciate my
dataset the relation collection remains empty.
if I set the nested property to default or false the relation will be
generated and I have access from code.
accessing and setting the nested property of my DataRelation to true
produces the result I need and everything works fine.
so what's wrong? the designer's handling of relationships or my
understanding of the designer? or do I miss to set a further property?
tia,
Thorsten Kallweit Tag: VB.NET PROJECT to C# Project conversion Tag: 89970
How to hide ID & password in RDS object definition
Can I hide Id & Password in ASP page for RDS object definition?
My RDS object is as below:
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" ID=RDS>
<PARAM NAME="SQL" VALUE="Select command...">
<PARAM NAME="SERVER" VALUE="http://server name">
<PARAM NAME="CONNECT" VALUE="Provider='sqloledb';user id=id123;password=pass123;Initial Catalog=db123">
</OBJECT>
Thnaks in advance.
p.dev Tag: VB.NET PROJECT to C# Project conversion Tag: 89965
databinding textboxes
ive bound textboxes in design and in code.
changes to the textboxes are reflected in the dataset, however, such changes do not get updated in the database. i have no problem with updating datagrids etc..
please advise...
thanks Tag: VB.NET PROJECT to C# Project conversion Tag: 89963
constraints from a dataset to a database
Hi,
I have a typed dataset that was once create from a database. As time
passed, we'd lost the original database, and had to recreate it.
However, we don't want manually to recreate the constraints also -
they are in the dataset.
Is there a way to automatically bring the constraints from the dataset
into the SQL database ?
Alex. Tag: VB.NET PROJECT to C# Project conversion Tag: 89962
checking if the dataset is empty?
HI There,
How can I check if the dataset is empty? I just want to check to see if the
dataset is empty or null when the query is run, couls someone help me out
with some code please?
Sean
Function getTheData(ByVal CategoryID as Integer) As DataTable
Dim DS As New DataSet()
Dim strConnect As New
SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
Dim objSQLAdapter As New SQLDataAdapter("SELECT L.manufacturer,
L.modeldesc, L.listprice,G.Location FROM tblListings L INNER JOIN tbLocation
G ON L.location = G.LocationID WHERE formid=" & CategoryID, strConnect)
objSQLAdapter.Fill(DS, "tblListings")
Return DS.Tables("tblListings").Copy
End Function
Sub doPaging(ByRef CategoryID)
pagedData.DataSource = getTheData(CategoryID).DefaultView
pagedData.AllowPaging = True
pagedData.PageSize = 10
Try
pagedData.CurrentPageIndex =
Int32.Parse(Request.QueryString("Page")).ToString()
Catch ex As Exception
pagedData.CurrentPageIndex = 0
End Try
btnPrev.Visible = ( NOT pagedData.IsFirstPage )
btnNext.Visible = ( NOT pagedData.IsLastPage )
pageNumber.Text = (pagedData.CurrentPageIndex + 1) & " of " &
pagedData.PageCount
theDataList.DataSource = pagedData
theDataList.DataBind()
End Sub Tag: VB.NET PROJECT to C# Project conversion Tag: 89959
Update failure
Error message: Argument 'Prompt' cannot be converted to type 'String' when I try to update a dataset.
Try
OleDbDataAdapter1.Update(ds, "PatientSummaryTBL")
Catch e As Exception
MsgBox(e)
End Try
much Appreciated Tag: VB.NET PROJECT to C# Project conversion Tag: 89958
Format currency in datalist items?
HI There,
I was wondering if you can format currency values in a datalist? I have
tried many ddiiferent ways to do this and all have given me errors.
Sean - thanks in advance
<%# DataBinder.Eval(Container.DataItem, "listprice")%>
DataFormatString="{0:$#,###.##}" Tag: VB.NET PROJECT to C# Project conversion Tag: 89957
Problem with Dataset for MS Access Yes/No Field
Hello All!
I have some problem with Yes/No field in MS Access.
In WebService I create DataSet and return it client like next:
DataSet ds = new DataSet( );
daContentList = new OdbcDataAdapter( mysection.SelectRequest,
( string )ConfigurationSettings.AppSettings[ "ConnectionString" ]
);
OdbcCommandBuilder cbContentList = new OdbcCommandBuilder(
daContentList );
if( mysection.TableName.Equals( string.Empty ) ){
daContentList.FillSchema( ds, SchemaType.Source, sName );
daContentList.Fill( ds, sName );
}else{
daContentList.FillSchema( ds, SchemaType.Source, mysection.TableName
);
daContentList.Fill( ds, mysection.TableName );
}
ds.DataSetName = sName;
return ds;
The code worked perfectly but Schema is incorrect in some places for
example for all xs:string, xs:int alements schema allowed
minOccurs="0" and for all bit fields xs:boolean minOccurs="1". This
behaviour is incorrect cause I have some mondatory Text fields and all
bit fields are optional
What's wrong with my schema for dataset?
Thanks Alex Tag: VB.NET PROJECT to C# Project conversion Tag: 89955
Threaded application, DataTables and DataGrids
Hi,
I'm novice with C# and have a little problem in my current project.
I'm updating some DataTable from different Thread. There's no problem to update the DB, but adding new records freeze the application because I've a datagrid showing the updates in realtime...
Principe :
myDataGrid.DataSource = new DataView(myDataTable);
After a lot of tests, it appears to be the fact of new rows created in another thread.
What can I do to go through this? Tag: VB.NET PROJECT to C# Project conversion Tag: 89949
hyperlinks with querystring values in a datagrid
Hi There,
I was wondering how I can have a hyperlink with a querystring value in a
datagrid? Could someone help me with an example please?
Sean - thanks in advance
<columns>
<asp:BoundColumn HeaderText="Make & Model" DataField="modeldesc" />
<asp:BoundColumn HeaderText="ID" DataField="modelID" />
<asp:BoundColumn HeaderText="listprice" DataField="listprice"
ItemStyle-HorizontalAlign="Right"
DataFormatString="{0:$#,###.##}" />
</columns> Tag: VB.NET PROJECT to C# Project conversion Tag: 89947
default values
It's MS Access database. Some table has a fields with default values, for
example, =Date().
But when I adding a row in DataGrid - the default values not displayed. If I
not fill this fields and then update dataset - in database all records added
via DataGrid - without default values.
How can I resolve this problem and default values displays in DataGrid?
Thanks.
--
Stanislaw Tristan
Kyiv, Ukraine
E-mail: stas7775@i.com.ua Tag: VB.NET PROJECT to C# Project conversion Tag: 89944
How to create a new table in SQL Server using DataTable
Hello,
Is it possible to write a DataTable to SQL Server.
I would like to create new DataTable with some columns and records. Now I would like to store this DataTable to SQL Server as a new Table.
Can someone let me know if this possible?.
Thanks
--
Rajiv Tag: VB.NET PROJECT to C# Project conversion Tag: 89943
Program crashes when network goes down and back up
I could definitely use some help with this error! My VB.NET 2003
program only connects to the database when the user saves, retrieves,
etc. If they retrieve a file from the database to work on, and the
network goes down for more than about ten seconds and comes back up,
the next time they try to save the program crashes on the first line
of code that talks to the db. Actually it gets as far as opening the
connection, but breaks on this line: objDataReader =
objCommand.ExecuteReader(CommandBehavior.CloseConnection) with this
error:
A first chance exception of type 'System.Data.SqlClient.SqlException'
occurred in system.data.dll
Additional information: System error.
The exception's error message is usually: General network error.
Check your network documentation.
I don't understand! It seems to me that if the network goes down and
comes back up while the program is running but not using the database,
then it should not cause any problems. Any ideas?
Thanks!
Kevin Tag: VB.NET PROJECT to C# Project conversion Tag: 89941
Update data without SQL statement
I want to update a table without using a sql statement.
I am hoping for something similar to ado update.
ds.Tables[0].Rows[x] ["authorid"] = "Rick"
ds.update
is something like this possible?
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com Tag: VB.NET PROJECT to C# Project conversion Tag: 89939
Should I use additional SQL Queries or use FindRows
Hi all, currently my application generates a DataSet object from a query issued to the database.
Then it uses some of the values from that DataSet object to send off further queries and so on.
However, I'm starting to wonder if it might be more efficient to use the "FindRows" method or RowFilter property on a DataView instead of issuing further queries.
Basically, I could retrieve all of the data into my DataSet and then create DataViews on that DataSet to do what I'm currently doing with a number of SQL queries.
However, the values I'm retrieving from the DataSet do not belong to any of the indices (primary key or otherwise) that I have built on the database tables. So it looks like I will have to use the "Sort" method before I can use the FindRows method.
Besides which, I don't know how to FindRows with the Null value (I'm guessing I just put Nothing as the object parameter). This is the code I've tried to use:
Dim myView As DataView
myView = myDataSet.Tables("some_table").DefaultView()
myView.Sort() = "column_in_table"
myView.FindRows(System.DBNull)
If I use the above code, I get the error:
Expecting 1 value(s) for the key being indexed, but received 0 value(s).
I'm guessing I need to be using "System.DBNull" somehow but I'm not sure how.
Or should I be using the RowFilter property:
myView.RowFilter = "column_in_table = NULL"
However, if I do it using the RowFilter I don't know how to generate the array of DataRowView objects. I need this since I'm not directly binding this data to a web control.
To summarize:
1. How should one determine whether it is more efficient to navigate data by issuing a SQL query for each step or whether it is more efficient to use the RowFilter property or FindRows method?
2. How can you use the FindRows method to find rows where an attribute/value in a column is set to NULL?
3. How can you get the array of DataRowObjects once you set the RowFilter property to the query string of your choosing?
Thanks,
Novice Tag: VB.NET PROJECT to C# Project conversion Tag: 89938
Hi,
DO we have any tool which will help us to convert the web project from the
VB.NET to C# language?
--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
"Vijay" <vijay@infosysusa.com> wrote in message
news:uDBLUTJVEHA.1164@tk2msftngp13.phx.gbl...
> Hi,
>
> DO we have any tool which will help us to convert the web project from
the
> VB.NET to C# language?
>
> Thanks,
> Vijay
>
>