What's Wrong With My Code?

Aug 30, 2006

I am using MVWD 2005 Express and Sql Server 2005 Express. I am using SqlDataSource control and GridView control to disply a ata table, and let user to input data into the database through dropdownlist and TextBox. When I run the application I always get exception:"Conversion failed when converting character string to smalldatetime data type." I could not find anything wrong. Could anybody out there help me find out what's wrong with my code. Much appreciate it.
Here is the code:
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource2" DataKeyNames="DocumentID">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" />
<asp:BoundField DataField="DocumentName" HeaderText="DocumentName" ReadOnly="True"
SortExpression="DocumentName" />
<asp:BoundField DataField="DateInput" HeaderText="Date" SortExpression="DateInput" />
<asp:BoundField DataField="Comments" HeaderText="Comments" SortExpression="Comments" />
<asp:BoundField DataField="DocumentCategory" HeaderText="Category" SortExpression="DocumentCategory" />
<asp:CheckBoxField DataField="TopDoc" HeaderText="TopDoc" SortExpression="TopDoc" />
</Columns>
<EmptyDataTemplate>
There is no data to be displayed!
</EmptyDataTemplate>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:ClubSiteDB %>" DeleteCommand="DELETE FROM [Documents] WHERE [DocumentID] = @original_DocumentID AND [DocumentName] = @original_DocumentName AND [DateInput] = @original_DateInput AND [Comments] = @original_Comments AND [DocumentCategory] = @original_DocumentCategory AND [TopDoc] = @original_TopDoc"
InsertCommand="INSERT INTO [Documents] ([DocumentName], [DateInput], [Comments], [DocumentCategory], [TopDoc]) VALUES (@DocumentName, @DateInput, @Comments, @DocumentCategory, @TopDoc)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [Documents]"
UpdateCommand="UPDATE [Documents] SET [DocumentName] = @DocumentName, [DateInput] = @DateInput, [Comments] = @Comments, [DocumentCategory] = @DocumentCategory, [TopDoc] = @TopDoc WHERE [DocumentID] = @original_DocumentID AND [DocumentName] = @original_DocumentName AND [DateInput] = @original_DateInput AND [Comments] = @original_Comments AND [DocumentCategory] = @original_DocumentCategory AND [TopDoc] = @original_TopDoc">
<DeleteParameters>
<asp:Parameter Name="original_DocumentID" Type="Int32" />
<asp:Parameter Name="original_DocumentName" Type="String" />
<asp:Parameter Name="original_DateInput" Type="DateTime" />
<asp:Parameter Name="original_Comments" Type="String" />
<asp:Parameter Name="original_DocumentCategory" Type="Int32" />
<asp:Parameter Name="original_TopDoc" Type="Boolean" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="DocumentName" Type="String" />
<asp:Parameter Name="DateInput" Type="DateTime" />
<asp:Parameter Name="Comments" Type="String" />
<asp:Parameter Name="DocumentCategory" Type="Int32" />
<asp:Parameter Name="TopDoc" Type="Boolean" />
<asp:Parameter Name="original_DocumentID" Type="Int32" />
<asp:Parameter Name="original_DocumentName" Type="String" />
<asp:Parameter Name="original_DateInput" Type="DateTime" />
<asp:Parameter Name="original_Comments" Type="String" />
<asp:Parameter Name="original_DocumentCategory" Type="Int32" />
<asp:Parameter Name="original_TopDoc" Type="Boolean" />
</UpdateParameters>
<InsertParameters>
<asp:ControlParameter Name="Comments" Type="String" ControlID="TextBox2" />
<asp:ControlParameter Name="DocumentCategory" Type="Int32" ControlID="DropDownList1" PropertyName="SelectedValue" />
<asp:ControlParameter Name="TopDoc" Type="Boolean" ControlID="RadioButton1" PropertyName="Checked" />
</InsertParameters>
</asp:SqlDataSource>
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim savePath As String = "C: empuploads"
Dim fileName As String = FileUpload1.FileName
Dim dt As DateTime = DateTime.Now
SqlDataSource2.InsertParameters.Add("DocumentName", fileName)
SqlDataSource2.InsertParameters.Add("DateInput", dt)
SqlDataSource2.Insert()
If (FileUpload1.HasFile) Then
savePath += FileUpload1.FileName
FileUpload1.SaveAs(savePath)
Label1.Text = "Your file was uploaded successfully."
DisplayFileContents(FileUpload1.PostedFile)
Else
Label1.Text = "You did not specify a file to upload."
End If
End Sub

View 4 Replies


ADVERTISEMENT

What Is Wrong With My Code. Please Help.

Mar 9, 2007

Hi im new and new to coding when i run the following code it gives me the following error can someone please help me and tell me where i am going wrong; "Invalid attempt to read when no data is present. "   using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class dclogin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected void BTNlogin_Click(object sender, EventArgs e)

{


String strSql;
SqlConnection conn = new SqlConnection("server=cssql; database=movie_stream; Trusted_Connection = true");
strSql = "SELECT MS_Customer.email_address,MS_Customer.Password FROM MS_Customer WHERE email_address = " + "'" + Txtemail.Text + "'";

SqlCommand dbCommand4 = new SqlCommand();
dbCommand4.CommandText = strSql;
dbCommand4.Connection = conn;
conn.Open();
SqlDataReader myDataReader = dbCommand4.ExecuteReader();
myDataReader.Read();


if (Txtpassword.Text == Convert.ToString(myDataReader["Password"]))
{


Response.Redirect("customer.aspx");
}

else
{
lblMessage.Text = "Please check your Email address and password and try again";
}


//newlabel.Text = Convert.ToString(myDataReader["Password"]);
conn.Close();
} // end chkpwd


} // end class 

View 8 Replies View Related

What Is Wrong In My Code???

Feb 4, 2005

SqlConnection CncDwBugNet = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);

SqlCommand Sql = new SqlCommand();
Sql.Connection = CncDwBugNet;

Sql.CommandText = "INSERT INTO filtro(descricao, cod_projeto, cod_usuarioowner, cod_usuarioview) VALUES (@Descricao, @CodProjeto, @CodUsuarioOwner, @CodUsuarioView)";

Sql.Parameters.Add("@Descricao", SqlDbType.VarChar).Value = LocalFilter.Nome;

if (LocalFilter.Project != 0)
Sql.Parameters.Add("@CodProjeto", SqlDbType.Int).Value = LocalFilter.Project;
else
Sql.Parameters.Add("@CodProjeto", SqlDbType.Int).Value = null;

Sql.Parameters.Add("@CodUsuarioOwner", SqlDbType.Int).Value = (int)HttpContext.Current.Session["User"];

if (LocalFilter.User != 0)
Sql.Parameters.Add("@CodUsuarioView", SqlDbType.Int).Value = LocalFilter.User;
else
Sql.Parameters.Add("@CodUsuarioView", SqlDbType.Int).Value = null;

-----
this error appears when i run executenonquery method...

"Prepared statement '(@Descricao varchar(2),@CodProjeto int,@CodUsuarioOwner int,@Cod' expects parameter @CodProjeto, which was not supplied."

View 2 Replies View Related

What Is Wrong With This Code?

Feb 4, 2005

SqlConnection CncDwBugNet = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);

SqlCommand Sql = new SqlCommand();
Sql.Connection = CncDwBugNet;

Sql.CommandText = "INSERT INTO filtro(descricao, cod_projeto, cod_usuarioowner, cod_usuarioview) VALUES (@Descricao, @CodProjeto, @CodUsuarioOwner, @CodUsuarioView)";

Sql.Parameters.Add("@Descricao", SqlDbType.VarChar).Value = LocalFilter.Nome;

if (LocalFilter.Project != 0)
Sql.Parameters.Add("@CodProjeto", SqlDbType.Int).Value = LocalFilter.Project;
else
Sql.Parameters.Add("@CodProjeto", SqlDbType.Int).Value = null;

Sql.Parameters.Add("@CodUsuarioOwner", SqlDbType.Int).Value = (int)HttpContext.Current.Session["User"];

if (LocalFilter.User != 0)
Sql.Parameters.Add("@CodUsuarioView", SqlDbType.Int).Value = LocalFilter.User;
else
Sql.Parameters.Add("@CodUsuarioView", SqlDbType.Int).Value = null;

-----
this error appears when i run executenonquery method...

"Prepared statement '(@Descricao varchar(2),@CodProjeto int,@CodUsuarioOwner int,@Cod' expects parameter @CodProjeto, which was not supplied."

View 1 Replies View Related

What Is Wrong With My Code?

Apr 25, 2006

I want to print out the table name and record count whenever a table has record(s), but the statement:
Print 'TableName: '+@TableName +' Row Count: '+CAST(@RCTR AS varchar)
never gets executed.

Any help is appreciated.

******************************************
SET NOCOUNT ON

DECLARE @TableName nvarchar(256), @SQL nvarchar(4000), @RCTR int

SET @TableName = ''
SET @RCTR = 0

WHILE @TableName IS NOT NULL
BEGIN
SET @TableName =
(
SELECT MIN(QUOTENAME(TABLE_NAME))
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
ANDQUOTENAME(TABLE_NAME) > @TableName
ANDOBJECTPROPERTY(
OBJECT_ID(QUOTENAME(TABLE_NAME)
), 'IsMSShipped') = 0
)

SET @SQL = ( 'select count(*) from ' + @TableName )
EXEC (@SQL)
SET @RCTR = @@ROWCOUNT
IF @RCTR > 0
Print 'TableName: ' + @TableName + ' Row Count: ' + CAST(@RCTR AS varchar)
END
*********************************

View 4 Replies View Related

Is There Something Wrong With My Code

Mar 30, 2006

SELECT * FROM BOOK_CUSTOMER WHERE STATE='FL' OR STATE='NJ' AND REFERRED=NULL;

Im sorry for posting this, but the results just arent working out. Im trying to display user information if the customer lives in florida or new jersey and they cant have a referring user. I tried the above combination and managed to only list the people from fl and got one user who was referred. I also tried:

SELECT * FROM BOOK_CUSTOMER WHERE REFERRED=NULL AND STATE='FL' OR STATE='NJ';

And I only get people from nj and also get one referred user. Can anyone point out what im doing wrong?

View 5 Replies View Related

What's Wrong With My Code?

Apr 25, 2006

I want to print out the table name and record count whenever a table has record(s), but the statement:
Print 'TableName: '+@TableName +' Row Count: '+CAST(@RCTR AS varchar)
never gets executed.

Any help is appreciated.

******************************************
SET NOCOUNT ON

DECLARE @TableName nvarchar(256), @SQL nvarchar(4000), @RCTR int

SET @TableName = ''
SET @RCTR = 0

WHILE @TableName IS NOT NULL
BEGIN
SET @TableName =
(
SELECT MIN(QUOTENAME(TABLE_NAME))
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
ANDQUOTENAME(TABLE_NAME) > @TableName
ANDOBJECTPROPERTY(
OBJECT_ID(QUOTENAME(TABLE_NAME)
), 'IsMSShipped') = 0
)

SET @SQL = ( 'select count(*) from ' + @TableName )
EXEC (@SQL)
SET @RCTR = @@ROWCOUNT
IF @RCTR > 0
Print 'TableName: ' + @TableName + ' Row Count: ' + CAST(@RCTR AS varchar)
END
*********************************

View 2 Replies View Related

Help With Code, Can't See What Is Wrong

Jun 28, 2006

Here is part of the code:
CREATE table Fornecedor (
codintCONSTRAINT RI_79 PRIMARY KEY,
NCint,
nomeVARCHAR(100),
telefoneint,
moradaVARCHAR(100),
CONSTRAINT RI_78 CHECK(cod>0),
CONSTRAINT RI_80 CHECK(telefone>0),
CONSTRAINT RI_81 CHECK(telefone is not null),
CONSTRAINT RI_83 CHECK(morada is not null),
CONSTRAINT RI_85 CHECK(nome is not null),
CONSTRAINT RI_86 UNIQUE(nome),
CONSTRAINT RI_87 CHECK(NC>0),
CONSTRAINT RI_88 CHECK(NC is not null),
CONSTRAINT RI_89 UNIQUE(NC)
);

CREATE table Encomenda (
codintCONSTRAINT Fornecedor_não_existe_I FOREIGN KEY REFERENCES Fornecedor(cod),
número_ordemint,
lojaintCONSTRAINT Loja_não_existe_IV FOREIGN KEY REFERENCES Loja(loja),
data_pedidoCHAR(8),
data_previstaCHAR(8),
data_entregaCHAR(8),
CONSTRAINT RI_117_72 PRIMARY KEY(cod,número_ordem),
CONSTRAINT RI_71 CHECK(número_ordem>0),
CONSTRAINT RI_74 CHECK(data_pedido is not null),
CONSTRAINT RI_76 CHECK(data_prevista is not null),
CONSTRAINT RI_118 CHECK(loja is not null)
);

CREATE table Encomenda_Disco (
codintCONSTRAINT Encomenda_não_existe_I FOREIGN KEY REFERENCES Encomenda(cod),
número_ordemintCONSTRAINT Encomenda_não_existe_II FOREIGN KEY REFERENCES Encomenda(número_ordem),
refintCONSTRAINT Disco_não_existe_VIII FOREIGN KEY REFERENCES Disco(ref),
quantidadeint,
CONSTRAINT RI_121_122_123 PRIMARY KEY(cod,número_ordem,ref),
CONSTRAINT RI_90 CHECK(quantidade>0),
CONSTRAINT RI_91 CHECK(quantidade is not null)
);

Returns me this error when I try to create Encomenda_Disco:
There are no primary or candidate keys in the referenced table 'Encomenda' that match the referencing column list in the foreign key 'Encomenda_não_existe_I'.

I have checked this code for more than an hour, and I'm starting to get prety anoyed with this. Can someone be kind enough to point me the error? :)

View 3 Replies View Related

What Is Wrong With This SQL Code ?

Feb 5, 2007

CREATE PROCEDURE VerifyIfInvoiceExists
(@Invoice VARCHAR(50))
AS
DECLARE @DoesExist BIT
IF EXISTS (SELECT NULL FROM IPN_received
WHERE Invoice = @Invoice)
SELECT @DoesExist = 1
ELSE SELECT @DoesExist = 0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I am getting an exception error. Any clue ?

View 3 Replies View Related

What Is Wrong With This Code?

Mar 30, 2007

select au_lname, au_fname,au_id
from authors
where 100 =all
(select royaltyper
from titleauthor
where titleauthor.au_id = authors.au_id)
This query uses database pubs. Why this code returns some au_id which is not in table titleauthor?
for example 527-72-3246 is not in titleauthor.

how to find the names of all authors who earn 100 percent royalty on all his/her books?

Thanks

=================================================



au_lnameau_fnameau_id
Blotchet-HallsReginald648-92-1872
CarsonCheryl238-95-7766
del CastilloInnes712-45-1867
GreeneMorningstar527-72-3246
LocksleyCharlene486-29-1786
McBaddenHeather893-72-1158
PanteleySylvia807-91-6654
SmithMeander341-22-1782
StraightDean274-80-9391
StringerDirk724-08-9931
WhiteJohnson172-32-1176

View 8 Replies View Related

What Is Wrong With This Code?

Jul 17, 2007

tickets = case when mrc.averageticket=null or mrc.averageticket=0, null, mccv.mccvamount/mrc.averageticket
end


Thanks

View 3 Replies View Related

Can Someone Tell Me What's Wrong With This Code?

Jul 23, 2005

Hi AllI keep getting back VINET and not Lilas...can someone point me in theright direction?Thanks a lotDECLARE @idoc intDECLARE @doc varchar(1000)SET @doc ='<ROOT><CustomerID>VINET </CustomerID><CustomerID>Lilas</CustomerID></ROOT>'--Create an internal representation of the XML document.EXEC sp_xml_preparedocument @idoc OUTPUT, @doc-- Execute a SELECT statement that uses the OPENXML rowset provider.SELECT *FROM OPENXML (@idoc, '/ROOT',2)WITH (CustomerID varchar(100) )

View 5 Replies View Related

What's Wrong With This Code?

Jul 13, 2007



Hi

whats wrong here?

it gives this error

c:documents and settings910287my documentsvisual studio projects
eport project1FCAT READING LEVELS.rdl The color expression for the textbox €˜textbox8€™ contains an error: [BC30201] Expression expected.






=IIF

(Fields!SCORE_Previous.Value < Fields!SCORE_Current.Value ,€™red€™,

(Fields!SCORE_Previous.Value > Fields!SCORE_Current.Value , €˜green€™,€™yellow€™))

View 2 Replies View Related

What's Wrong With This SQL Query/code?

Sep 12, 2007

 I keep getting the error "Invalid attempt to read when no data is present" when trying to query a table in my SQL DB.  I have checked and rechecked and the table name and column names within it are spelled correctly.  There are only three records in the database, they all have data in them, and the code in Country.Text precisely matches the data in the Country field in one of the records.
 
 It's worth mentioning that when I use Visual Studio 2005's little direct SQL query tool to build and run the following SQL statement that it works properly:
 
SELECT        Country, WordForStateFROM            data_CountriesWHERE        (Country = N'Jordan')
 
I am perplexed.  Any ideas anybody...here is the code...?
 
Dim SelectSQL_Countries As String
SelectSQL_Countries = "SELECT * FROM data_Countries "
SelectSQL_Countries &= "WHERE Country='" & Country.Text & "'"Dim con_Countries As New SqlConnection(ConfigurationManager.ConnectionStrings("MySiteMainDB").ConnectionString)
Dim cmd_Countries As New SqlCommand(SelectSQL_Countries, con_Countries)Dim reader_Countries As SqlDataReader
Try
con_Countries.Open()
reader_Countries = cmd_Countries.ExecuteReader()StateID.Text = reader_Countries("WordForState")
reader_Countries.Close()Catch err As Exception
lblResults.Text = err.Message
Finally
con_Countries.Close()
End Try

View 3 Replies View Related

What Wrong With My Connection Code?

Apr 19, 2005

Below is my connection code..
Public Class clsConnect
Public Shared Function getConnection () AS SQLConnection
Dim strConn As String = "Data Source=PPS_SERVER;" & _
"Initial Catalog=eCommunity;User ID=sa;Password=pps"
Dim DBConn As SqlConnection
DBConn = New SqlConnection(strConn)
DBConn.Open()
Return DBConn
End Function
 
However when i run the web this error was appeared. what possibility of this problem?
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 12: DBConn = New SqlConnection(strConn)
Line 13:
Line 14: DBConn.Open()
Line 15:
Line 16: return DBConn

View 2 Replies View Related

Could Someone Tell Me Whats Wrong With This Code?

Jun 25, 2004

I cant get this to work for some reason i am clueless, here is my code:

And here is the error:
//////////////////////////////////////////////////////////
ADODB.Recordset error '800a0e79'

Operation is not allowed when the object is open.

/home/details.asp, line 106
/////////////////////////////////////////////////////////

Begin Code:

/////////////////////////////////////////////////////////
<%
Color = "#05D1B8"
rma_id = Request.QueryString("rma_id")
SQL = "SELECT * FROM TBL_RMA WHERE RMA_ID='"&rma_id&"'"
rs.open SQL, Conn
If Not rs.BOF Then
%>
<table>
<tr>
<td bgcolor="<%=Color%>">RMA ID</td>
<td bgcolor="<%=Color%>">DATE GENERATED</td>
</tr>
<tr>
<td><%=rs("RMA_ID")%></td>
<td><%=rs("RMA_DATE_GENERATED")%></td>
</tr>
</table>
</br>
<table>
<tr>
<td bgcolor="<%=Color%>">RMA STATUS</td>
</tr>
<tr>
<td><%=rs("RMA_STATUS_ID")%></td>
</tr>
</table>
<br>
<table>
<tr>
<td bgcolor="<%=Color%>">PART NUMBER</td>
<td bgcolor="<%=Color%>">DESCRIPTION</td>
<td bgcolor="<%=Color%>">SERIAL NUMBER</td>
</tr>
<tr>
<td><%=rs("RMA_PRODUCT_ID")%></td>
<td><%=rs("RMA_PRODUCT_ID_DESCRIPTION")%></td>
<td><%=rs("RMA_SERIAL_NUMBER")%></td>
</tr>
</table>
<br>
<table>
<tr>
<td bgcolor="<%=Color%>">RECEIVED DATE</td>
<td bgcolor="<%=Color%>">PRIORITY</td>
<td bgcolor="<%=Color%>">TRANSACTION</td>
</tr>
<tr>
<td><%=rs("RMA_PRODUCT_ARRIVAL_DATE")%></td>
<td><%=rs("RMA_PRIORITY_ID")%></td>
<td><%=rs("RMA_TRANSACTION_TYPE_ID")%></td>
</tr>
</table>
<table>
<tr>
<td bgcolor="<%=Color%>">PROBLEM DESCRIPTION</td>
</tr>
<tr>
<td><%=rs("RMA_PROBLEM_DESCRIPTION")%></td>
</tr>
</table>
<br>
<table>
<tr>
<td bgcolor="<%=Color%>">TO MFG</td>
<td bgcolor="<%=Color%>">VIA</td>
<td bgcolor="<%=Color%>">MFG RA</td>
</tr>
<tr>
<td><%=rs("RMA_TO_MFG_DATE")%></td>
<td><%=rs("RMA_TO_MFG_VIA")%></td>
<td><%=rs("RMA_TO_MFG_RA")%></td>
</tr>
<tr>
<td bgcolor="<%=Color%>">FROM MFG</td>
<td bgcolor="<%=Color%>">VIA</td>
</tr>
<tr>
<td><%=rs("RMA_FROM_MFG_DATE")%></td>
<td><%=rs("RMA_FROM_MFG_VIA")%></td>
</tr>
</table>
<table>
<tr>
<td bgcolor="<%=Color%>">PROBLEM FOUND</td>
</tr>
<tr>
<td><%=rs("RMA_PROBLEM_FOUND")%></td>
</tr>
</table>
<%
Else
Response.Redirect("http://usautomatic.dyndns.org/home/failed.asp")
End If
If rs.EOF Then
rs.Close
End If
%>
<%
rma_id = Request.QueryString("rma_id")
CUSTOMER_ID = session("CUSTOMER_ID")
SQL = "SELECT * FROM tracking_export.csv WHERE CUSTOMERID='"&CUSTOMER_ID&"' AND RMA_ID='"&rma_id&"'"
rs.open SQL, Conn2
If Not rs.BOF Then
%>
<tr>
<td><a href="http://wwwapps.ups.com/WebTracking/processInputRequest?HTMLVersion=5.0&sort_by=status&tracknums_displayed=5&TypeOfInquiryNumber=T&loc=en_US&InquiryNumber1=<%=rs("ShipmentID")%>&InquiryNumber2=&InquiryNumber3=&InquiryNumber4=&InquiryNumber5=&AgreeToTermsAndConditions=yes&track.x=32&track.y=6">Track</a></td>
</tr>
<%
Else
Response.Redirect("http://usautomatic.dyndns.org/home/failed.asp")
End If
If rs.EOF Then
RS.Close
End If
%>
/////////////////////////////////////////////////////////

Any help would be appreciated.

Thanks,
X-Centric

View 6 Replies View Related

What Is Wrong With This Code(paging SP)

Dec 7, 2006

CREATE PROCEDURE Page4
(
@startRowIndex int,
@maximumRows int
)
AS

DECLARE @first_id int, @startRow int

-- A check can be added to make sure @startRowIndex isn't > count(1)
-- from employees before doing any actual work unless it is guaranteed
-- the caller won't do that

-- Get the first employeeID for our page of records
SET ROWCOUNT @startRowIndex
SELECT @first_id = CAST(DATE as int) FROM TOPIC

-- Now, set the row count to MaximumRows and get
-- all records >= @first_id
SET ROWCOUNT @maximumRows

SELECT * FROM TOPIC WHERE CAST(DATE as int) >= @first_id

SET ROWCOUNT 0

GO

I have the date field clustered DESC

The code always starts at the same place but maximum rows always adjusts to my input unlike the startrowindex. What am I doing wrong?

View 2 Replies View Related

What Is Wrong With This Piece Of Code?

Feb 7, 2007

select sub1.*, case sub1.mdiff when sub1.mdiff<12 then 1 else 0 end as flag

error msg by query analyser
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '<'.
Server: Msg 156, Level 15, State 1, Line 12
Incorrect syntax near the keyword 'as'.


Thanks

Jeff

View 2 Replies View Related

Whats Wrong With This Code?

Dec 13, 2007

CREATE TABLE [dbo].[TestTable]( [Column1] [int] (SQL_Latin1_General_Cp437_BIN) not null, [Column2] [varchar] (7) not null, [Column3] [bit] not null, [Column4] [int] Null, [Column5] [varchar] (12) Null, [Column6] [varchar] (24) Null, [Column7] [varchar] (56) Null ) ON [Primary]

View 1 Replies View Related

Whats Wrong With This Code

Dec 2, 2007



Hi

I am running this piece of code to execute a package programatically and Yet I get Failure. What could be Wrong with this. If so can anyone tell me How I can debug in SSIS.



Imports Microsoft.SqlServer.Dts.Runtime

Module Module1

Sub Main()

Dim pkgLocation As String

Dim pkg As New Package

Dim app As New Application

Dim pkgResults As DTSExecResult

pkgLocation = _

"c:ssisintegration services project2integration services project2Package.dtsx"

pkg = app.LoadPackage(pkgLocation, Nothing)

pkgResults = pkg.Execute()

Console.WriteLine(pkgResults.ToString())

Console.ReadKey()

End Sub

End Module

View 3 Replies View Related

Please Can Someone Point Out Whats Wrong With My Code

Nov 3, 2007

Hi,I have code on a page to update one table and insert info into another, but I cant make it work. I am new to coding and i think there are many mistakes. Please can someone pick out a few that need to be changed for the page to work.Code:private bool ExecuteUpdate(int quantity){  SqlConnection con = new SqlConnection();  con.ConnectionString = "ConnectionString";  con.Open();  SqlCommand command = new SqlCommand();  command.Connection = con;  TextBox TextBox1 = (TextBox)FormView1.FindControl("TextBox1");  Label labname = (Label)FormView1.FindControl("Label3");  Label labid = (Label)FormView1.FindControl("Label13");                        command.CommandText = "UPDATE Items SET Quantityavailable WHERE productID='@productID'  = " + TextBox1.Text + command.ExecuteNonQuery();        return true;  con.Close();}    private bool ExecuteInsert(String quantity)    {        SqlConnection con = new SqlConnection();        con.ConnectionString = "ConnectionString";        con.Open();        SqlCommand command = new SqlCommand();        command.Connection = con;        TextBox TextBox1 = (TextBox)FormView1.FindControl("TextBox1");        Label labname = (Label)FormView1.FindControl("Label3");        Label labid = (Label)FormView1.FindControl("Label13");        command.CommandText = "INSERT Transactions SET Usersname = @UserName" +          "; INSERT Transactions SET Itemid WHERE productID='@productID' = @productID; INSERT Transactions SET itemname = @Itemsname" +          "; INSERT Transactions SET Date WHERE productID='@productID' = " + DateTime.Now.ToString() +          "; INSERT Transactions SET Qty WHERE productID='@productID' = " + TextBox1.Text;        command.Parameters.Add("@UserName", System.Web.HttpContext.Current.User.Identity.Name);        command.Parameters.Add("@Itemsname", labname.Text);        command.Parameters.Add("@productID", labid.Text);        command.ExecuteNonQuery();        return true;        con.Close();    }protected void Button2_Click(object sender, EventArgs e){  TextBox TextBox1 = FormView1.FindControl("TextBox1") as TextBox;  ExecuteUpdate(Int32.Parse(TextBox1.Text) );  ExecuteInsert(Int32.Parse);} Current error message is:The best overloaded method match for 'detailproview.ExecuteInsert(string)' has some invalid argumentsto Line 74: ExecuteInsert(Int32.Parse); Thanks if someone can help!Jon  

View 3 Replies View Related

(GUID Problem) What Is Wrong With This Code ?

Oct 23, 2005

Hi, just learning SQL2000.I have this code:                mSQL = "UPDATE Contactpersonen SET Naam=? WHERE ContactpersoonID=?"                Command = New SqlClient.SqlCommand(mSQL, C_CP)                Command.Parameters.Add("Naam", txtNaam.Text)                Command.Parameters.Add("CPID", SqlDbType.UniqueIdentifier).Value = m_CP_IDwhere m_CP_ID is defined as a GUID in:    Public Property m_CP_ID() As Guid        Get            If Not viewstate("m_CP_ID") Is Nothing Then                Return viewstate("m_CP_ID")            End If            'Return 0        End Get        Set(ByVal Value As Guid)            viewstate("m_CP_ID") = Value        End Set    End PropertyWhen running the app I got this error:Server Error in '/4D' Application.--------------------------------------------------------------------------------
Line 1: Incorrect syntax near 'Naam'. Line 1: Incorrect syntax near '?'. (points to mSQL above)I know it has something to do with the GUID, but I cannot guess what.Help is appreciated, Ger.
 
 
 

View 2 Replies View Related

Another GUID Problem... What Is Wrong With This Code ?

Oct 24, 2005

Hi, I have the following code:        Dim RowLoopIndex As Integer        DsFuncties.Clear()        A_Functies.Fill(DsFuncties)        For RowLoopIndex = 0 To (DsFuncties.Tables("Functies").Rows.Count - 1)            If DsFuncties.Tables("Functies").Rows(RowLoopIndex).Item("FunctieID") = Func_ID Then                Func_naam = (DsFuncties.Tables("Functies").Rows(RowLoopIndex).Item("Functienaam"))                DDL_Functie.SelectedIndex = RowLoopIndex + 1                Exit For            End If        NextFunc_ID has been declared as follows:    Public Property Func_ID() As Guid        Get            If Not viewstate("Func_ID") Is Nothing Then                Return viewstate("Func_ID")            End If        End Get        Set(ByVal Value As Guid)            viewstate("Func_ID") = Value        End Set    End PropertyOn the red line I got the following tooltip (error):Operator '=' is not defined for types 'System.Object' and 'System.Guid'.How can I define '=' and eg. '&' for type System.Guid ???? Or another solution ??Help is appreciated, Ger.

View 3 Replies View Related

What's The Case When I Run The Code Is Right In SQLEXPRESS2005 But Wrong In Sql2000

Mar 21, 2007

 Hi everyone
when i run the below code using sql2000 ,the error was occured,anyone can tell me what's wrong and how to solve it thanks
 the error is :
Appointed conversion is invalidation
InvalidCastException: Appointed conversion is invalidation]   PhotoManager.GetPhotos(Int32 AlbumID) +571
[TargetInvocationException: ]   System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0   System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +358   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29   System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +482   System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +2040   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70   System.Web.UI.WebControls.GridView.DataBind() +4   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69   System.Web.UI.Control.EnsureChildControls() +87   System.Web.UI.Control.PreRenderRecursiveInternal() +41   System.Web.UI.Control.PreRenderRecursiveInternal() +161   System.Web.UI.Control.PreRenderRecursiveInternal() +161   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
 
well i plaster the source's code in the below :
1�the test.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server">    <title>æ— æ ‡é¢˜é¡µ</title></head><body>    <form id="form1" runat="server">    <div>        &nbsp;        &nbsp;&nbsp;<asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1" AutoGenerateColumns="False">            <Columns>                <asp:BoundField DataField="AlbumCategoryID" HeaderText="AlbumCategoryID" ReadOnly="True"                    SortExpression="AlbumCategoryID" />                <asp:BoundField DataField="Caption" HeaderText="Caption" ReadOnly="True" SortExpression="Caption" />                <asp:BoundField DataField="LastModified" HeaderText="LastModified" ReadOnly="True"                    SortExpression="LastModified" />                <asp:BoundField DataField="ViewCount" HeaderText="ViewCount" ReadOnly="True" SortExpression="ViewCount" />                <asp:BoundField DataField="PhotoID" HeaderText="PhotoID" ReadOnly="True" SortExpression="PhotoID" />                <asp:BoundField DataField="Location" HeaderText="Location" ReadOnly="True" SortExpression="Location" />                <asp:BoundField DataField="AlbumID" HeaderText="AlbumID" ReadOnly="True" SortExpression="AlbumID" />            </Columns>        </asp:GridView>        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetPhotos"            TypeName="PhotoManager">            <SelectParameters>                <asp:Parameter DefaultValue="1" Name="AlbumID" Type="Int32" />            </SelectParameters>        </asp:ObjectDataSource>    </div>    </form>    </body></html>
 
2�the PhotoManager's class is : public static List GetPhotos(int AlbumID)
{
using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Personal"].ConnectionString))
{
using (SqlCommand command = new SqlCommand("GetPhotos", connection))
{
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new SqlParameter("@AlbumID", AlbumID));
command.Parameters.Add(new SqlParameter("@IsPublic", 1));
connection.Open();
List list = new List();
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{

Photo temp = new Photo(
(int)reader["PhotoID"],
(int)reader["AlbumID"],
(string)reader["Caption"],
(string)reader["Location"],
(int)reader["ViewCount"],
(DateTime)reader["LastModified"],
(int)reader["AlbumCategoryID"]
);

list.Add(temp);



}

}
return list;

}
}


}
 
 
3�photo.cs is using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Web;
public class Photo
{

private int _id;
private int _albumid;
private string _caption;
private string _location;

private int _ViewCount;

private DateTime _LastModified;
private int _AlbumCategoryID;


public int PhotoID { get { return _id; } }
public int AlbumID { get { return _albumid; } }
public string Caption { get { return _caption; } }
public string Location
{
get
{
return _location;
}
}

public int ViewCount
{
get
{
return _ViewCount;
}
}

public DateTime LastModified
{
get
{
return _LastModified;
}
}

public int AlbumCategoryID
{
get
{
return _AlbumCategoryID;
}
}


public Photo(int id, int albumid, string caption, string location, int viewcount, DateTime lastmodified,int AlbumCategoryID)
{
_id = id;
_albumid = albumid;
_caption = caption;
_location = location;
_ViewCount = viewcount;
_LastModified = lastmodified;
_AlbumCategoryID = AlbumCategoryID;

}

}

4�the StoredProcedure
"GetPhotos" is : ALTER PROCEDURE [dbo].[GetPhotos] @AlbumID int, @IsPublic bitAS SELECT [Photos].[AlbumID],[Photos].[PhotoID],[Photos].[Caption],[Photos].
[Location],[Photos].[ViewCount],[Photos].[LastModified], [Albums].[AlbumCategoryID]
 FROM [Photos] LEFT JOIN [Albums]  ON [Albums].[AlbumID] = [Photos].[AlbumID]   WHERE [Photos].[AlbumID] = @AlbumID  AND ([Albums].[IsPublic] =@IsPublic OR [Albums].[IsPublic] = 1)  ORDER BY [Photos].[Caption] ASC
 
RETURN 

View 1 Replies View Related

Handling Poison Messages Sample Code In BOL Wrong?

Jul 28, 2005

In the "Example: Detecting a Poison Message" section, it reads: This Transact-SQL example shows a simple, stateless service that includes logic for handling poison messages. Before the stored procedure receives a message, the procedure saves the transaction. When the procedure cannot process a message, the procedure rolls the transaction back to the save point. The partial rollback returns the message to the queue while continuing to hold a lock on the conversation group for the message.

View 1 Replies View Related

What Is Wrong With This Code? Selecting Data With Stored Procedure With Multiple Parameters

Sep 22, 2005

oConn = New SqlClient.SqlConnection
oConn.ConnectionString = "user id=MyUserID;data source=MyDataSource;persist security info=False;initial catalog=DBname;password=password;"
oCmd = New SqlClient.SqlCommand
oCmd.Connection = oConn
oCmd.CommandType = CommandType.StoredProcedure
oCmd.CommandText = "TestStdInfo"
'parameters block
oParam1 = New SqlClient.SqlParameter("@intSchoolID", Me.ddlSchl.SelectedItem.ToString())
oParam1.Direction = ParameterDirection.Input
oParam1.SqlDbType = SqlDbType.Int
oCmd.Parameters.Add(oParam1)
oParam2 = New SqlClient.SqlParameter("@dob", Convert.ToDateTime(Me.txbBirth.Text))
oParam2.Direction = ParameterDirection.Input
oParam2.SqlDbType = SqlDbType.DateTime
oCmd.Parameters.Add(oParam2)
oParam3 = New SqlClient.SqlParameter("@id", Me.txbID.Text)
oParam3.Direction = ParameterDirection.Input
oParam3.SqlDbType = SqlDbType.VarChar
oCmd.Parameters.Add(oParam3)
oConn.Open()
daStudent = New SqlClient.SqlDataAdapter("TestStdInfo", oConn)
dsStudent = New DataSet
daStudent.Fill(dsStudent)  'This line is highlighted when error happens
oConn.Close()The error I am getting :Exception Details: System.Data.SqlClient.SqlException: Procedure 'TestStdInfo' expects parameter '@intSchoolID', which was not supplied.I am able to see the value during debugging in the autos or command window. Where does it dissapear when it comes to Fill?Could anybody help me with this, if possible fix my code or show the clean code where the procedure called with multiple parameters and dataset filled.Thank you so much for your help.

View 2 Replies View Related

Sql Server 2005 Inserting Prbblem..wrong SQL? Wrong Parameter?

Feb 19, 2006

Im trying to insert a record in my sql server 2005 express database.The following function tries that and without an error returns true.However, no data is inserted into the database...Im not sure whether my insert statement is correct: I saw other example with syntax: insert into table values(@value1,@value2)....so not sure about thatAlso, I havent defined the parameter type (eg varchar) but I reckoned that could not make the difference....Here's my code:        Function CreateNewUser(ByVal UserName As String, ByVal Password As String, _        ByVal Email As String, ByVal Gender As Integer, _        ByVal FirstName As String, ByVal LastName As String, _        ByVal CellPhone As String, ByVal Street As String, _        ByVal StreetNumber As String, ByVal StreetAddon As String, _        ByVal Zipcode As String, ByVal City As String, _        ByVal Organization As String _        ) As Boolean            'returns true with success, false with failure            Dim MyConnection As SqlConnection = GetConnection()            Dim bResult As Boolean            Dim MyCommand As New SqlCommand("INSERT INTO tblUsers(UserName,Password,Email,Gender,FirstName,LastName,CellPhone,Street,StreetNumber,StreetAddon,Zipcode,City,Organization) VALUES(@UserName,@Password,@Email,@Gender,@FirstName,@LastName,@CellPhone,@Street,@StreetNumber,@StreetAddon,@Zipcode,@City,@Organization)", MyConnection)            MyCommand.Parameters.Add(New SqlParameter("@UserName", SqlDbType.NChar, UserName))            MyCommand.Parameters.Add(New SqlParameter("@Password", Password))            MyCommand.Parameters.Add(New SqlParameter("@Email", Email))            MyCommand.Parameters.Add(New SqlParameter("@Gender", Gender))            MyCommand.Parameters.Add(New SqlParameter("@FirstName", FirstName))            MyCommand.Parameters.Add(New SqlParameter("@LastName", LastName))            MyCommand.Parameters.Add(New SqlParameter("@CellPhone", CellPhone))            MyCommand.Parameters.Add(New SqlParameter("@Street", Street))            MyCommand.Parameters.Add(New SqlParameter("@StreetNumber", StreetNumber))            MyCommand.Parameters.Add(New SqlParameter("@StreetAddon", StreetAddon))            MyCommand.Parameters.Add(New SqlParameter("@Zipcode", Zipcode))            MyCommand.Parameters.Add(New SqlParameter("@City", City))            MyCommand.Parameters.Add(New SqlParameter("@Organization", Organization))            Try                MyConnection.Open()                MyCommand.ExecuteNonQuery()                bResult = True            Catch ex As Exception                bResult = False            Finally                MyConnection.Close()            End Try            Return bResult        End FunctionThanks!

View 1 Replies View Related

Help With Converting Code: VB Code In SQL Server 2000-&&>Visual Studio BI 2005

Jul 27, 2006

Hi all--I'm trying to convert a function which I inherited from a SQL Server 2000 DTS package to something usable in an SSIS package in SQL Server 2005. Given the original code here:
Function Main()
on error resume next
dim cn, i, rs, sSQL
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"
set rs = CreateObject("ADODB.Recordset")
set rs = DTSGlobalVariables("SQLstring").value

for i = 1 to rs.RecordCount
sSQL = rs.Fields(0).value
cn.Execute sSQL, , 128 'adExecuteNoRecords option for faster execution
rs.MoveNext
Next

Main = DTSTaskExecResult_Success

End Function

This code was originally programmed in the SQL Server ActiveX Task type in a DTS package designed to take an open-ended number of SQL statements generated by another task as input, then execute each SQL statement sequentially. Upon this code's success, move on to the next step. (Of course, there was no additional documentation with this code. :-)

Based on other postings, I attempted to push this code into a Visual Studio BI 2005 Script Task with the following change:

public Sub Main()

...

Dts.TaskResult = Dts.Results.Success

End Class

I get the following error when I attempt to compile this:

Error 30209: Option Strict On requires all variable declarations to have an 'As' clause.

I am new to Visual Basic, so I'm on a learning curve here. From what I know of this script:
- The variables here violate the new Option Strict On requirement in VS 2005 to declare what type of object your variable is supposed to use.

- I need to explicitly declare each object, unless I turn off the Option Strict On (which didn't seem recommended, based on what I read).

Given this statement:

dim cn, i, rs, sSQL

I'm looking at "i" as type Integer; rs and sSQL are open-ended arrays, but can't quite figure out how to read the code here:

Set cn = CreateObject("ADODB.Connection")

cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"

set rs = CreateObject("ADODB.Recordset")

This code seems to create an instance of a COM component, then pass provider information and create the recordset being passed in by the previous task, but am not sure whether this syntax is correct for VS 2005 or what data type declaration to make here. Any ideas/help on how to rewrite this code would be greatly appreciated!

View 7 Replies View Related

How To Show Description In Report Instead Of Code (Desc For Code Is In Master Table)

Mar 28, 2007

Dear Friends,



I am having 2 Tables.

Table 1: AddressBook
Fields --> User Name, Address, CountryCode



Table 2: Country
Fields --> Country Code, Country Name


Step 1 : I have created a Cube with these two tables using SSAS.



Step 2 : I have created a report in SSRS showing Address list.

The Column in the report are User Name, Address, Country Name



But I have no idea, how to convert this Country Code to Country name.

I am generating the report using the Layout tab. ( Data | Layout | Preview ) Report1.rdl [Design]



Anyone help me to solve this issue. Because, in our project most of the transaction tables have Code and Code description in master table. I need to convert all code into corresponding description in all my reports.




Thanks in advance.





Regards
Ramakrishnan
Singapore
28 March 2007

View 4 Replies View Related

Many Lines Of Code In Stored Procedure && Code Behind

Feb 24, 2008

Hello,
I'm using ASP.Net to update a table which include a lot of fields may be around 30 fields, I used stored procedure to update these fields. Unfortunatily I had to use a FormView to handle some TextBoxes and RadioButtonLists which are about 30 web controls.
I 've built and tested my stored procedure, and it worked successfully thru the SQL Builder.The problem I faced that I have to define the variable in the stored procedure and define it again the code behind againALTER PROCEDURE dbo.UpdateItems
(
@eName nvarchar, @ePRN nvarchar, @cID nvarchar, @eCC nvarchar,@sDate nvarchar,@eLOC nvarchar, @eTEL nvarchar, @ePhone nvarchar,
@eMobile nvarchar, @q1 bit, @inMDDmn nvarchar, @inMDDyr nvarchar, @inMDDRetIns nvarchar,
@outMDDmn nvarchar, @outMDDyr nvarchar, @outMDDRetIns nvarchar, @insNo nvarchar,@q2 bit, @qper2 nvarchar, @qplc2 nvarchar, @q3 bit, @qper3 nvarchar, @qplc3 nvarchar,
@q4 bit, @qper4 nvarchar, @pic1 nvarchar, @pic2 nvarchar, @pic3 nvarchar, @esigdt nvarchar, @CCHName nvarchar, @CCHTitle nvarchar, @CCHsigdt nvarchar, @username nvarchar,
@levent nvarchar, @eventdate nvarchar, @eventtime nvarchar
)
AS
UPDATE iTrnsSET eName = @eName, cID = @cID, eCC = @eCC, sDate = @sDate, eLOC = @eLOC, eTel = @eTEL, ePhone = @ePhone, eMobile = @eMobile,
q1 = @q1, inMDDmn = @inMDDmn, inMDDyr = @inMDDyr, inMDDRetIns = @inMDDRetIns, outMDDmn = @outMDDmn,
outMDDyr = @outMDDyr, outMDDRetIns = @outMDDRetIns, insNo = @insNo, q2 = @q2, qper2 = @qper2, qplc2 = @qplc2, q3 = @q3, qper3 = @qper3,
qplc3 = @qplc3, q4 = @q4, qper4 = @qper4, pic1 = @pic1, pic2 = @pic2, pic3 = @pic3, esigdt = @esigdt, CCHName = @CCHName,
CCHTitle = @CCHTitle, CCHsigdt = @CCHsigdt, username = @username, levent = @levent, eventdate = @eventdate, eventtime = @eventtime
WHERE (ePRN = @ePRN)
and the code behind which i have to write will be something like thiscmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@eName", ((TextBox)FormView1.FindControl("TextBox1")).Text);cmd.Parameters.AddWithValue("@ePRN", ((TextBox)FormView1.FindControl("TextBox2")).Text);
cmd.Parameters.AddWithValue("@cID", ((TextBox)FormView1.FindControl("TextBox3")).Text);cmd.Parameters.AddWithValue("@eCC", ((TextBox)FormView1.FindControl("TextBox4")).Text);
((TextBox)FormView1.FindControl("TextBox7")).Text = ((TextBox)FormView1.FindControl("TextBox7")).Text + ((TextBox)FormView1.FindControl("TextBox6")).Text + ((TextBox)FormView1.FindControl("TextBox5")).Text;cmd.Parameters.AddWithValue("@sDate", ((TextBox)FormView1.FindControl("TextBox7")).Text);
cmd.Parameters.AddWithValue("@eLOC", ((TextBox)FormView1.FindControl("TextBox8")).Text);cmd.Parameters.AddWithValue("@eTel", ((TextBox)FormView1.FindControl("TextBox9")).Text);
cmd.Parameters.AddWithValue("@ePhone", ((TextBox)FormView1.FindControl("TextBox10")).Text);
cmd.Parameters.AddWithValue("@eMobile", ((TextBox)FormView1.FindControl("TextBox11")).Text);
So is there any way to do it better than this way ??
Thank you

View 2 Replies View Related

Custom Code (Embedded Code) Question

Oct 16, 2007



Hi all,

Could someone tell me if custom code function can capture the event caused by a user? For example, onclick event on the rendered report?

Also, can custom code function alter the parameters of the report, or refresh the report?

Thanks.

View 2 Replies View Related

Putting SqlDataSource Code In Code-behind

Jan 25, 2007

Hi,I need some help here. I have a SELECT sql statement that will query the table. How do I get the return value from the sql statement to be assigned to a label. Any article talk about this? Thanks  geniuses.  

View 2 Replies View Related

&&<Code&&>-8462&&</Code&&>

Apr 19, 2006

Hi:

My service broker is working with 2 different instances in local server.But could not able to get working on 2 different servers because of Conversation ID cannot be associated with an active conversation error which I have posted.

After I receive the message successfully...in the end I get this message sent...

<Error xmlns="http://schemas.microsoft.com/SQL/ServiceBroker/Error">

<Code>-8462</Code>

<Description>The remote conversation endpoint is either in a state where no more messages can be exchanged, or it has been dropped.</Description>

</Error>

Why am i gettting this error after the conversation.

Thanks,

Pramod

View 7 Replies View Related







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