Msdn Article On Getting @Identity Question
Sep 26, 2007
the msdn article explains how to input new data to a databse and return the primary key of the inputted row. It works perfectly. However, it explains how to insert a value, but there is a problem. It seems to set the value to be submitted in the VB code, instead of having the value be the user's input in the textbox. Look for the following line in the code below: newRow("ClientFileNumber") = "ClientFileNumber" It inputs "clientfilenumber" instead of what is actually inputted in the texbox. Does anyone know how to bypass this, to not have the words "clientfilenumber" inputted?Dim sqlconn As SqlConnection = New SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Client.mdf;Integrated Security=True;User Instance=True")
Dim catDA As SqlDataAdapter = New SqlDataAdapter("SELECT * FROM Orders", sqlconn)
catDA.InsertCommand = New SqlCommand("JobInsert", sqlconn)
catDA.InsertCommand.CommandType = CommandType.StoredProcedure
catDA.InsertCommand.Parameters.Add("@ClientFileNumber", SqlDbType.VarChar, 50, "ClientFileNumber")Dim NewJobNumber As SqlParameter = catDA.InsertCommand.Parameters.Add("@Identity", SqlDbType.Int, 0, "OrdersID")
NewJobNumber.Direction = ParameterDirection.Output
sqlconn.Open()
Dim catDS As DataSet = New DataSetcatDA.Fill(catDS, "Orders")
Dim newRow As DataRow = catDS.Tables("Orders").NewRow()
newRow("ClientFileNumber") = ""catDS.Tables("Orders").Rows.Add(newRow)
catDA.Update(catDS, "Orders")
sqlconn.Close()
Response.Redirect("control_page_copy.aspx?NewJobNumber=" + NewJobNumber.Value.ToString())
View 1 Replies
ADVERTISEMENT
Sep 20, 2006
I have been trying to straighten out the select statement(underlined) in the procedure below but no luck. It is at the link below:(User-Specific Paging from ASP.NET)http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/scalenethowto05.aspI think the "author" messed up during the copy and paste. Someone please help out. I really need its correct version. Thanks.blumonde // The BindData method constructs a SQL query that uses nested SELECT TOP // statements (as described earlier) to retrieve a specified page of data.//public void BindData(){ SqlConnection myConnection = new SqlConnection(_connStr); String strCmd = ""; StringBuilder sb = new StringBuilder(); sb.Append("select top {0} CustomerID,CompanyName,ContactName,ContactTitle from (select top {1} CustomerID,CompanyName,ContactName,ContactTitle from Customers "); sb.Append("as t1 order by contactname desc) "); sb.Append("as t2 order by contactname asc"); strCmd = sb.ToString(); sb = null; // Set pseudoparameters: TableName, KeyField and RowIndex strCmd = String.Format(strCmd, _pageSize, _currentPageNumber * _pageSize); // Prepare the command SqlCommand myCommand = new SqlCommand(strCmd,myConnection); SqlDataAdapter sa = new SqlDataAdapter(myCommand); DataSet searchData = new DataSet("SearchData"); try { myConnection.Open(); sa.Fill(searchData); MyDataGrid.DataSource = searchData; MyDataGrid.DataBind(); } finally { myConnection.Close(); } CurrentPage.Text = _currentPageNumber.ToString(); if ( !Page.IsPostBack ) { using (SqlConnection conn = new SqlConnection(_connStr)) { SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT Count(*) FROM Customers"; conn.Open(); _totalRecords = (int)cmd.ExecuteScalar(); _totalPages = _totalRecords / MyDataGrid.PageSize; TotalPages.Text = _totalPages.ToString(); } } else { _totalPages = int.Parse ( TotalPages.Text ); } if (_currentPageNumber == 1) { PreviousPage.Enabled = false; if (_totalPages > 1) NextPage.Enabled = true; else NextPage.Enabled = false; } else { PreviousPage.Enabled = true; if (_currentPageNumber == _totalPages) NextPage.Enabled = false; else NextPage.Enabled = true; }}
View 32 Replies
View Related
Mar 22, 1999
Hi
I have installed the MSDN SQL 7.0 final release on 2 Win NT (1 server and 1 Wkst)
When I launch DTS, I CAN export/import ACCESS <--> SQL and vice versa
I CANNOT export/import SQL7 <--> SQL7
I have this error messsage :
"The licence for installation of Microsoft SQL Server
on your source and destination connections does not permit the use
of DTS to transform data. refer to your licence agreement for more
information"
any ideas why ? Is there any limitation with MSDN CD ?
View 1 Replies
View Related
Aug 31, 2007
Hello,
I recently got me a new laptop with Vista preinstalled. All good and well, but when I try to install a program vital for my profession, I get an error (OS not supported for this program). In the install I can configure what components to install, one of them is MSDN 2000. My question is, will SQL Server Express take over what MSDN can't on Vista (and thus running the program needing the MSDN 2000), or will windows XP be the new OS on my brand new laptop in the future. Love Vista, hate the compatibility.
View 1 Replies
View Related
Mar 14, 2008
Where is the list for forums,
When i started to write for Sqlserver, i never searched or looked for forum. Same did when i was working with the c#.
Now I have to find the correct forum. So where is the list of those forums, thanks.
View 3 Replies
View Related
Jun 6, 2007
Why are there 2 RS forums on MSDN
This is the other one
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs
This one has a worse UI
View 2 Replies
View Related
Oct 16, 2006
Hello,
Using VS 2005 SP1 beta and SQL Server 2005.
I am trying to learn how SQL CLR works by using this example:
http://msdn2.microsoft.com/en-us/library/5czye81z.aspx
When I press F5, I get this error:
A .NET Framework error occurred during execution of user defined routine or aggregate 'InsertCurrency':
System.Data.SqlClient.SqlException: Must declare the scalar variable "@CurrencyCode".
Do I need to declare @CurrencyCode in the Test.sql script?
Thanks for any suggestions,
Tom
View 7 Replies
View Related
Feb 2, 2007
Are there any limits to the number of user that can connect or anything like that with SQL 2000 (MSDN Vs)?
Thanks!
View 1 Replies
View Related
Jul 20, 2005
I was hoping I can get some help regarding subject mater located athttp://msdn.microsoft.com/library/d...des_02_92k3.aspMyTable has 23 fields with 100,000 records.Field1 nvarchar 90Field2 char 6Field3 varchar 8000Field4 nvarchar 200Field5 nvarchar 200Field6 nvarchar 200Field7 nvarchar 200Field8 nvarchar 200Field9 char 30Field10 char 30Field11 nvarchar 200Field12 nvarchar 200Field13 float 8Field14 datetime 8Field15 datetime 8Field16 datetime 8Field17 nvarchar 200Field18 nvarchar 200Field19 varchar 8000Field20 nvarchar 200Field21 nvarchar 200Field22 nvarchar 200Field23 varchar 8000Data Types:nvarchar = Variable-length, Storage is 2 times the # of characters enteredchar = Fixed-length. Storage is n bytesvarchar = Variable-length, Storage is actual length in bytes of data enteredfloat = Is float Fixed-length?, my precisions are 15 digits so 8 bytes.datetime = Is datetime Fixed-length?, Storage is 8 bytesI need the following blanks filled in for me, please :-)Num_Rows 100,000Num_Cols 23Fixed_Data_SizeNum_Variable_Cols 16Max_Var_SizeNull_Bitmap Int(2 + ((23 + 7) / 8)) = 5?Variable_Data_SizeRow_SizeRows_Per_PageFree_Rows_Per_Page 100 (no clustered index created)Num_PagesTable Size
View 2 Replies
View Related
Jan 18, 2007
If we purchase a new MSDN Professional subscription, does it come with SQL Server 2000 developer license?
View 3 Replies
View Related
May 19, 2008
Hi all,
An internal licensing review is being carried out at my site for the first time since I joined. I have been asked to confirm that development SQL Server instances have been installed from MSDN installation disks and production instances from non-MSDN disks. I understand that serverproperty('licensetype') will show me this information in SQL Server 2000, and I am (perhaps incorrectly?) assuming that a result of "DISABLED" means MSDN was used for the installation.
In SQL Server 2005, i believe the installation does not record the necessary information in the registry, meaning serverproperty('licensetype') is of no use.
Is the question i've been asked impossible to answer? Is there any way I can find out if MSDN disks (or network copies of them) were used to install a SQL Server 2005 instance?
Many thanks.
James
View 4 Replies
View Related
Aug 16, 2007
We use MSDN SQL 2000 , the enterprise edition for our development servers,
which have always had 2GB RAM.
Now they are bringing in a Win 2003 Enterprise with > 12GB RAM .
They want SQL SERVER 2000 to use AWE memory up to 12GB . Is there any limitation
on MSDN Ent. Edition using more memory.?
View 2 Replies
View Related
Dec 26, 2006
Hi
Is this an upgrade for sql server 2005 express.
If I already have Sql server 2005 express must I still download
the whole file.
Rgds
Rob
View 2 Replies
View Related
Sep 18, 2007
Hi,
I have seen many examples at MSDN library related to SQL Querries in all queries one thing is same the way they use tables in there queries. BUT wht is this really i am not getting this, can anyone tell me.. the code and the problem is as follows:
Code Snippet
FROM Purchasing.ProductVendor JOIN Purchasing.Vendor
ON (ProductVendor.VendorID = Vendor.VendorID)In the above code u see "Purchasing.ProductVendor", I want to ask that wht is this
Purchasing Stands for, If we suppose that purxchasing is the database name then also
normally we use database name as Purchasing.dbo.ProductVendor BUT I am not getting that
what is this,
Please if someone knows then explain it to me,
Thanks.
View 2 Replies
View Related
Jul 10, 2004
First off - complete newbie using MSDN.
Getting the error message
System.Data.SqlClient.SqlException: SELECT permission denied on object 'mytable', database 'master', owner 'dbo'. at System.Data.SqlClient.SqlCommand.ExecuteReader...
1. After a lot of googling I've done the following:
EXEC sp_grantlogin 'MYMACHINEASPNET' to grant the ASPNET logon access to the DB
2. Changed the
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSSQLServerMSSQLServerLoginMode
to 2 to allow mixed mode.
3. using my connection string in web.config - have experimented with different strings with/without trusted_connection and the sa uname and pwd.
(Current connection string is
"server=localhost;Integrated Security=SSPI;Database=master;Data Source=MYCOMPUTERNAME;trusted_Connection=yes"
I'm NOT using SQL Server so what commands do i need to give my db/table SELECT permissions? (and who am I giving permission to - very confused)
I had no bother accessing the server and DB from a simple C# command line program.
Been pulling my hair out for many hours now... any help would be greatly appreciated!
View 1 Replies
View Related
Jul 10, 2004
(Not having a great day - didn't mean to lock that last post - apologies)
First off - complete newbie using MSDN.
Getting the error message
System.Data.SqlClient.SqlException: SELECT permission denied on object 'mytable', database 'master', owner 'dbo'. at System.Data.SqlClient.SqlCommand.ExecuteReader...
1. After a lot of googling I've done the following:
EXEC sp_grantlogin 'MYMACHINEASPNET' to grant the ASPNET logon access to the DB
2. Changed the
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSSQLServerMSSQLServerLoginMode
to 2 to allow mixed mode.
3. using my connection string in web.config - have experimented with different strings with/without trusted_connection and the sa uname and pwd.
(Current connection string is
"server=localhost;Integrated Security=SSPI;Database=master;Data Source=MYCOMPUTERNAME;trusted_Connection=yes"
I'm NOT using SQL Server so what commands do i need to give my db/table SELECT permissions? (and who am I giving permission to - very confused)
I had no bother accessing the server and DB from a simple C# command line program.
Been pulling my hair out for many hours now... any help would be greatly appreciated!
View 5 Replies
View Related
Nov 3, 2005
Hi,How can I tell If my sql server is MSDN or Standard or Enterpriseversion.Thank youAR
View 5 Replies
View Related
Mar 30, 2007
Check out the new Books Online search functionality online. The link below provides a scoped search of Books Online that returns a more precise and targeted result set. You can use it to search Books Online content quickly.
http://search.live.com/macros/sql_server_user_education/booksonline
Please direct your feedback to SQLServerUE@hotmail.com.
View 3 Replies
View Related
Apr 28, 2008
I don't know why I can not see 'sign in' button on msdn forums now at my company's computer. I can see that button several days ago, but now I can not see it. Why? I only can see post but can not create a new one or reply.
At home computer everything is fine.
Thanks.
View 2 Replies
View Related
Oct 27, 2006
I am new to SSIS 2005
http://msdn2.microsoft.com/en-us/library/ms167106.aspx
SSIS 2005 MSDN Tutorial - Lesson 1 - subsection namely 'Adding and Configuring the Lookup Transformations ' - in that STEP 7 not working. Not able to select the 'columns' tab.
Anybody worked-out this Lesson1 with the step provided by MSDN.
Pls help. Thanks
View 3 Replies
View Related
Oct 18, 2007
I'm trying to use the MSDN subscriber downloads VPC image for SQL Server 2008 CTP4. There are 4 files listed as 1 of 4, 2 of 4, ... 4 of 4.
When executing the WinRAR self-extracting archive, it runs normally for a while and starts to create a .VHD file but just when it seems to be almost complete, it stops and asks for "c:mypathen_sql_server_2008_ctp_4_vhd_part_1_of_5_.rar".
Since the files were just posted back on 10/9, I thought I would wait and eventually, someone would notice the problem and post corrected files but now it's been over a week and I don't see new files or any mention of any problems.
Is anyone else able to successfully download and extract this image?
LaRoux
View 3 Replies
View Related
Jun 18, 2007
As I am begininng to believe that is the only edition I am going to be able to run on my Vista Utlimate os.
Standard does not install server components.
I believe SQL Express was working as installed with Visual Studio 2005, but I need the use the tools that SQL Express does not contain.
Thanks,
_Greg
View 3 Replies
View Related
May 5, 2006
Problem 1 > Manual uninstalltion of Beta VS MSDN 2005 .
Throwing error ...
Unable to install (Internal fault occured)
Problem 2 > Uninstallation using Microsoft uninstller of Beta (VS, SQL etc)
Throwing error ...
"MS SQL Server 2005 Ex CTP
The set up ha sencountered an error in datsource Error in installds
XMLrw error : failure looking xmlrw.dll. check procedure () return 2"
View 1 Replies
View Related
Aug 18, 2005
I installed Sql 2005 on a Win2003, Sp1 platform. Some problems but nothing too big. Next I attempted to install VS 2005 (June) CTP. The install faled and here's the error log:
View 1 Replies
View Related
Jan 9, 2004
Tech firms defend moving U.S. jobs overseas (http://www.msnbc.msn.com/default.aspx?id=3899043&p1=0)
Any thoughts or comments?
View 14 Replies
View Related
Dec 28, 2005
The SQL SERver 2005 Standard Edidtion install CD and the MSDN CD distributedat the SQLServer Launch in Chicago are blank. Has anyone else had thisproblem and or requested replacements? If so, how.thanks muchMo
View 1 Replies
View Related
May 14, 2007
if I have the following code:
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Tasks.SendMailTask;
class TestSendMailTask
{
public static void Main()
{
Package pkg = new Package();
ConnectionManager smtpCM;
smtpCM = pkg.Connections.Add("SMTP");
smtpCM.Name = "SMTP Connection Manager";
smtpCM.ConnectionString = "smtphost";
Executable exe = pkg.Executables.Add("STOCKendMailTask");
TaskHost thSendMailTask = (TaskHost)exe;
{
thSendMailTask.Properties["SmtpConnection"].SetValue(thSendMailTask, "SMTP Connection Manager");
thSendMailTask.Properties["ToLine"].SetValue(thSendMailTask, "someone1@example.com");
thSendMailTask.Properties["CCLine"].SetValue(thSendMailTask, "someone2@example.com");
thSendMailTask.Properties["BCCLine"].SetValue(thSendMailTask, "someone3@example.com");
thSendMailTask.Properties["FromLine"].SetValue(thSendMailTask, "someone4@example.com");
thSendMailTask.Properties["Priority"].SetValue(thSendMailTask, MailPriority.Normal);
thSendMailTask.Properties["FileAttachments"].SetValue(thSendMailTask, "C:\test_image.jpg");
thSendMailTask.Properties["Subject"].SetValue(thSendMailTask, "Testing the SendMail Task");
thSendMailTask.Properties["MessageSourceType"].SetValue(thSendMailTask, SendMailMessageSourceType.DirectInput);
thSendMailTask.Properties["MessageSource"].SetValue(thSendMailTask, "This is only a test.");
}
DTSExecResult valResults = pkg.Validate(pkg.Connections, pkg.Variables, null, null);
if (valResults == DTSExecResult.Success)
{
pkg.Execute();
}
}
}
-------
How do I make it a workable package so it compiles , w/ javadoc style comments and instructions, so, other people can use it?
View 20 Replies
View Related
Aug 8, 2006
I am experiencing the behaviour described in this kb article:
http://support.microsoft.com/default.aspx?scid=kb;en-us;825019
but I am reliably informed that both the sql 2000 boxes which are linked have been patched to sp4.
Has anyone had any experience of this issue recurring post patching?
View 1 Replies
View Related
Dec 23, 2004
Hi,
I'm use MSSQL2000 SP3 with replication.
I want to know that Can i add new article to existing publication by
Enterprice Manager ?
someone told me that we can do that in older version but not now,right? :confused:
View 1 Replies
View Related
Feb 2, 2006
MS has post a KB article on how to post a question on a online forum...
http://support.microsoft.com/kb/q555375
At first I though this was hilarious, but there is actually some good information in here that is applicable on this forum as well as anywhere else. Perhaps Brett could add this as a sticky?
Regards,
hmscott
View 2 Replies
View Related
Jun 19, 2008
Dear All,
i'm in the transactional replication environment. we need to add one new table to the publisher. it is sql server 2005 environment. please explain me the steps
and in another table, i need to change the data type of a table.
please guide me
Arnav
Even you learn 1%, Learn it with 100% confidence.
View 15 Replies
View Related
Oct 31, 2007
hi
i'm new to replication. i'm looking for a full article that explains Replication good, can u take a link to that article ?
thanks
View 5 Replies
View Related