Showing posts with label connection. Show all posts
Showing posts with label connection. Show all posts

Tuesday, March 27, 2012

Calling Stored Procedure

I have a created a report that needs to call a sybase Stored Procedure, my connection string is fine. I am able to call the sp from sql advantage passing in several parameters and it runs just fine. However when I created a dataset and tried to call it through the reporting service I get the following error message.

An error occurred while retrieving the parameters in the query. Unknown SQL type - 28265. I cannot seem to find any information about this error. Does anyone have any suggestions on how to call a sp from sybase?I solved the problem!!!!|||

I am calling the sybase stored procedure i am getting string to int32 conversion error in Reporting Server 2005.

if anyone got any solution, please let me know. Thanks in advance

|||Would you like to share the answer?|||

I can't solve the same problem. Please, share the answer!

Calling Stored Procedure

I have a created a report that needs to call a sybase Stored Procedure, my connection string is fine. I am able to call the sp from sql advantage passing in several parameters and it runs just fine. However when I created a dataset and tried to call it through the reporting service I get the following error message.

An error occurred while retrieving the parameters in the query. Unknown SQL type - 28265. I cannot seem to find any information about this error. Does anyone have any suggestions on how to call a sp from sybase?I solved the problem!!!!|||

I am calling the sybase stored procedure i am getting string to int32 conversion error in Reporting Server 2005.

if anyone got any solution, please let me know. Thanks in advance

|||Would you like to share the answer?|||

I can't solve the same problem. Please, share the answer!

Calling Stored Procedure

I have a created a report that needs to call a sybase Stored Procedure, my connection string is fine. I am able to call the sp from sql advantage passing in several parameters and it runs just fine. However when I created a dataset and tried to call it through the reporting service I get the following error message.

An error occurred while retrieving the parameters in the query. Unknown SQL type - 28265. I cannot seem to find any information about this error. Does anyone have any suggestions on how to call a sp from sybase?I solved the problem!!!!|||

I am calling the sybase stored procedure i am getting string to int32 conversion error in Reporting Server 2005.

if anyone got any solution, please let me know. Thanks in advance

|||Would you like to share the answer?|||

I can't solve the same problem. Please, share the answer!

Calling Stored Procedure

I have a created a report that needs to call a sybase Stored Procedure, my connection string is fine. I am able to call the sp from sql advantage passing in several parameters and it runs just fine. However when I created a dataset and tried to call it through the reporting service I get the following error message.

An error occurred while retrieving the parameters in the query. Unknown SQL type - 28265. I cannot seem to find any information about this error. Does anyone have any suggestions on how to call a sp from sybase?I solved the problem!!!!|||

I am calling the sybase stored procedure i am getting string to int32 conversion error in Reporting Server 2005.

if anyone got any solution, please let me know. Thanks in advance

|||Would you like to share the answer?|||

I can't solve the same problem. Please, share the answer!

Thursday, March 22, 2012

calling my connection from pages

I have been looking everywhere and cant seem to find out how to do this using 2.0

I would like to have my connection strign in my web.config file being decralred publicly in my pages so that I dont have to repeat lines of code throughout pages.

In my web.config I have this.
<connectionStrings>
<add name="myconn" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>

then in my pages I have

Imports System.Data
Imports System.Data.SqlClient

Public sqlconnection As New SqlConnection(ConfigurationSettings.AppSettings("myconn"))
Public sqlcommand As New SqlCommand
Public sqldataAdapter As New SqlDataAdapter
Public sSQL as String

Function getdata()
sSQL = "INSERT INTO tbl_Idea (Status) value (@.Status)
Dim dbcommand As New System.Data.SqlClient.SqlCommand(sSQL, sqlconnection)

Dim statusparam As New SqlParameter("@.Status", SqlDbType.NVarChar)
statusparam.Value = "PENDING"
dbcommand.Parameters.Add(statusparam)

sqlconnection.Open()
dbcommand.ExecuteNonQuery()
sqlconnection.Close()

for some reason this code does not seem to work. It keeps telling me The ConnectionString Property has not been initialized.

I do the same thing in my asp.net 1.1 pages using vs 2003. Can some one help or atleast point in the right direction.

thanks

Hi,

Here is the simple explanation:

Your connection string in the web.config is not in the AppSettings section but in the connectionStrings section.

so instead of reading it like in your code:
Public sqlconnection As New SqlConnection(ConfigurationSettings.AppSettings("myconn"))

you just read it from the connectionStrings section like so:
Public

Dim sqlconnectionAsNew SqlConnection(ConfigurationManager.ConnectionStrings("myconn").ConnectionString)

This will do the job

Have fun

G.

|||dude ur the bomb. thanks a lot.

Tuesday, March 20, 2012

calling another server connection through a stored procedure

anybody have an idea how to call a server through a stored procedure...

ex)
from my asp, i connect to sql server then call a stored procedure...in the stored procedure i want to connect to a remote database (jdedwards) and bring back tables to use in that procedure that eventually is used for output.

how do you make the connection to jde?You can do it through either linked server or remote server. Either way, you need to register the 2nd server on the first server. Provided permision is granted, you then run query in the 'select * from serverName.dbName.owner.tableName' format.|||thanks!

but now HOW DO I register my sql server to connect to a non Sql Server....the only way I can connect to the other Database is through ODBC? In other words, I need my sql server's stored procedure to ODBC to a non SQL server; i.e., AS/400.

Wednesday, March 7, 2012

Call or Reference a Stored Procedure from a published report

Hi All,
Got a report published that uses a stored procedure which is on a different
server in our Domain. I have the correct connection string info entered via
the Report Manager / Data Sources tab, but how and where does one reference
the SP to execute it? The SP does work in BIDS.
Thanx,
~SDDid you check if the user that reads the report has the execute permission
on the SP?
What error message are you getting?
--
Alain Quesnel
alainsansspam@.logiquel.com
www.logiquel.com
"iamscott" <iamscott@.discussions.microsoft.com> wrote in message
news:D3B5C2A0-49AC-4786-AE1C-68990FF487D1@.microsoft.com...
> Hi All,
> Got a report published that uses a stored procedure which is on a
> different
> server in our Domain. I have the correct connection string info entered
> via
> the Report Manager / Data Sources tab, but how and where does one
> reference
> the SP to execute it? The SP does work in BIDS.
> Thanx,
> ~SD
>|||The reference to the SP is in the report. If the report uses a shared
datasource then the datasource is used to get the connection and the report
RDL specifies the stored procedure. The rendering engine then executes the
SP. There is no way to force the SP to execute other than trying to run the
report.
But, it is also possible to embed the datasource into the report rather than
used a shared datasource. If that is the case and it is wrong or has some
issue with it then you will have problems. Most people use shared data
sources.
You say it has the correct connection information. What type of credentials
are you using. Are you securely storing the credentials or are you using
integrated security. If integrated then it will be using the windows
credentials of the user running the report which might not have correct
permissions for SQL Server. I always securely stored the credentials. I use
a SQL account that I have as a read only account which is given execute
permission on any necessary stored procedures. You can also do this with a
domain account but I prefer running in mixed mode and uses a SQL account.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"iamscott" <iamscott@.discussions.microsoft.com> wrote in message
news:D3B5C2A0-49AC-4786-AE1C-68990FF487D1@.microsoft.com...
> Hi All,
> Got a report published that uses a stored procedure which is on a
> different
> server in our Domain. I have the correct connection string info entered
> via
> the Report Manager / Data Sources tab, but how and where does one
> reference
> the SP to execute it? The SP does work in BIDS.
> Thanx,
> ~SD
>

Friday, February 24, 2012

Calendar Control and Database Connection

Hi,
I m trying to implement a calendar, where you can select certain dates and view list of events for that day. The list is generated from database. I found a script on the web that is quite similar to what i want to achieve. I tried to run this script, however I get an exeption saying:

An error has occurred while establishing a connection to the server. ... error: 40 - Could not open a connection to SQL Server)

This is the code:
SqlConnection mycn;
SqlDataAdapter myda;
DataSet ds = new DataSet();
DataSet dsSelDate;
String strConn;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
strConn = "Data Source=localhost;Initial Catalog=pubs";

mycn = new SqlConnection(strConn);
myda = new SqlDataAdapter("Select * FROM EventsTable", mycn);
myda.Fill(ds, "Table"); //This where I get the exeption
}

protected void CalendarDRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
{
// If the month is CurrentMonth
if (!e.Day.IsOtherMonth)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
if ((dr["EventDate"].ToString() != DBNull.Value.ToString()))
{
DateTime dtEvent = (DateTime)dr["EventDate"];
if (dtEvent.Equals(e.Day.Date))
{
e.Cell.BackColor = System.Drawing.Color.PaleVioletRed;
}
}
}
}
//If the month is not CurrentMonth then hide the Dates
else
{
e.Cell.Text = "";
}
}

private void Calendar1_SelectionChanged(object sender, System.EventArgs e)
{
myda = new SqlDataAdapter("Select * from EventsTable where EventDate='" +
Calendar1.SelectedDate.ToString() + "'", mycn);
dsSelDate = new DataSet();
myda.Fill(dsSelDate, "AllTables");
if (dsSelDate.Tables[0].Rows.Count == 0)
{
DataGrid1.Visible = false;
}
else
{
DataGrid1.Visible = true;
DataGrid1.DataSource = dsSelDate;
DataGrid1.DataBind();
}
}


Can some one tell me what is wrong with the code.
Thank You

WATCH THIS SPACE

I resolve the issue by correcting the connection string within the strCon.

WATCH THIS SPACE